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 Set up LoginManager

Whats wrong with my code

I having a problem with this challenge can someone help. i'm totally stuck

lunch.py
from flask import Flask, g
from flask.ext.login import LoginManager

import models

app = Flask(__name__)
app.secret_key = 'bjhgdve,fb.eh/erghgw,evjngvmeerGRblmvw'

login_manager = LoginManager()
login_manager.init_app(app)
login_manager.login_view = 'login'


@login_manager.user_loader
def load_user(userid):
    try:
        return models.User.get(models.id) == userid
    except models.DoseNotExist:
        return None

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Francis Chokuwamba ! I received your request for assistance. You're doing terrific and I see you made it all the way to the very last step. There are two errors in the return statement and one typo in the except.

You typed:

 return models.User.get(models.id) == userid

The parentheses are misplaced here and you are missing the User part from your models. It should be:

 return models.User.get(models.User.id == userid)

In your except, the "s" is in the wrong place. You wrote:

except models.DoseNotExist:

But you meant to write:

except models.DoesNotExist:

The "s" should come immediately before the "N".

Hope this helps! :sparkles:

Thanks Jennifer