<s> from flask import flash <EOL> from flask . ext . wtf import Form <EOL> from wtforms import TextField , SubmitField , ValidationError , BooleanField , validators <EOL> from . . models import Todo <EOL> import views <EOL> from flask . ext . login import current_user <EOL> def todo_exists ( form , field ) : <EOL> todo = views . parse_todo ( form . todo . data ) [ <NUM_LIT:0> ] <EOL> print todo <EOL> todo_db = current_user . todo . filter_by ( description = todo ) . first ( ) <EOL> if todo_db != None : <EOL> raise ValidationError ( "<STR_LIT>" ) <EOL> class TodoForm ( Form ) : <EOL> todo = TextField ( "<STR_LIT>" , [ validators . DataRequired ( ) , todo_exists ] ) <EOL> submit = SubmitField ( "<STR_LIT>" ) </s>
