Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Build a Social Network with Flask Takin' Names Form with Validators

Timothy Baney
seal-mask
.a{fill-rule:evenodd;}techdegree
Timothy Baney
Python Web Development Techdegree Student 5,988 Points

Bug Maybe ?

I am stuck with this objective where you are meant to create a class form with an email and password field. It keeps telling me that I didnt create the form fields. I tried several different variations, and double checked all my code. I had to import Form from wtforms instead of flask-wtf, but it successfully brought me to the next challenge so I don't think thats it. There is another question from another community member with the same problem where it is telling them that the fields weren't created, but there was never any logged resolution.

forms.py
from wtforms import Form, StringField, PasswordField
from wtforms.validators import DataRequired, Email, Length

class SignUpForm(Form):
    email = StringField()
    password = PasswordField()

1 Answer

andren
andren
28,558 Points

The code checker for these challenges is far from perfect. Not only in the sense that it can be overly picky, but also in the sense that it can allow certain errors go get through due to the way the task checks are written.

Due to this having your code pass one task is no guarantee of your code being correct. And since different tasks have different checks you can get an errors on one task that is caused by code written on a previous task.

In order to complete this challenge you do have to import Form from Flask-WTF, importing it from wtforms is not the same. When importing from Flask-WTF you use the name flask_wtf like this:

from flask_wtf import Form
from wtforms import StringField, PasswordField
from wtforms.validators import DataRequired, Email, Length

class SignUpForm(Form):
    email = StringField()
    password = PasswordField()