Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Now that we can save posts in the database, let's create a form and view for capturing them from the user.
We assigned the database and the current user, from Flask Login, to the g
object, Flask's global attribute that gets passed around to all of our views automatically, so now we can use it to get the current user.
Alert!
In this video and the others in this course, you'll see me using {{ current_user.is_authenticated() }}
. At the time of filming, this was the correct way to use the is_authenticated()
method on the UserMixin
from flask-login
. BUT, as is often the case in open source, things have changed. You'll now want to always use it as a property instead. So, use {{ current_user.is_authenticated }}
instead. No parentheses!
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up