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 View

Takin Names: Build a social network app. Help passing task 3. I'm pretty sure there is a problem with the grading.

MODERATOR added markdown for code readability

@app.route('/register', methods = ("GET", "POST"))
def register():
  form = forms.SignUpForm()
  if form.validate_on_submit():
    models.User.new(
      email=form.email.data, 
      password=form.password.data)  
    return redirect(url_for('/'))
  return render_template('register.html', form=form)

3 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

This forum post from a few months ago may be of some help. Have a look.

Keep Coding! :)

I read that post and still received the same error.

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

After some trial and error and much research in the forums, I came up with this that does pass 3 of 3. I don't usually give the answers, but I know how frustrating this track can be...

Keep coding! :)

@app.route("/register", methods=('GET','POST'))
def register():
    form = forms.SignUpForm()
    flash("Thanks for registering!")

    if form.validate_on_submit():

        models.User.new(
          email=form.email.data,
          password=form.password.data
          )
    return render_template('register.html', form=form)