Answer the question
In order to leave comments, you need to log in
What's wrong with a flask project?
Hi all!
I'm studying flask from a tutorial on Habré, I ran into such an error, I've been fighting for several days now:
File "c:\users\morozovg\documents\flaskstudyenv\lib\site-packages\wtforms\fields\core.py", line 226, in _run_validation_chain
validator(form, self)
TypeError: __init__() takes from 1 to 2 positional arguments but 3 were given
from flask_wtf import FlaskForm
from wtforms import StringField,PasswordField,BooleanField,SubmitField
from wtforms.validators import DataRequired
class LoginForm(FlaskForm):
username = StringField('Username', validators=[DataRequired])
password = PasswordField('Password', validators=[DataRequired])
remember_me = BooleanField('remember Me')
submit = SubmitField('Sign in')
@app.route('/login', methods=['GET','POST'])
def login():
form = LoginForm()
if form.validate_on_submit():
flash('Login requested for user {}, remember_me={}'.format(
form.username.data, form.remember_me.data))
return redirect('/index')
return render_template('login.html', title='Sign in', form=form)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question