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

DataRequired()

is not iterable... lots of errors on this even after that one is fixed and all i did is add the layouts portion of it... it all works in the video, cant imagine why it doesnt now.

from flask_wtf import Form from wtforms import StringField, PasswordField from wtforms.validators import (DataRequired, Regexp, ValidationError, Email, Length, EqualTo )

from models import User

def name_exists(form, field): if User.select().where(User.username == field.data).exists(): raise ValidationError('User with that name already exists.')

def email_exists(form, field): if User.select().where(User.email == field.data).exists(): raise ValidatonError('User with that email already exists.')

class RegisterForm(Form): username = StringField( 'Username', validators=[ DataRequired(), Regexp( r'^[a-zA-Z0-9_]+$', message= ("Username should be one word, " "letters, numbers, and underscores only.") ), name_exists ]) email = StringField( 'Email', validators=[ DataRequired(), Email(), email_exists ]) password = PasswordField( 'Password', validators=[ DataRequired(), Length(min=2), EqualTo('password2', message='Passwrods must match') ]) password2 = PasswordField( 'Confirm Password', validators=[DataRequired()])

class LoginForm(Form): email = StringField('Email', validators=[DataRequired(), Email()]) password = PasswordField('Password',validators=DataRequired())