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 Broadcasting Stream Templates

Martin Cornejo Saavedra
Martin Cornejo Saavedra
18,132 Points

Difference between user.posts and current_user.get_stream() ?

Hello Kenneth, in the app.py file of this social network project in flask, go to the '/stream' view please. Is there a difference between the following definitions?

stream = current_user.get_stream().limit(100)

#and

stream = current_user.posts.limit(100)

I ask this, because you used the second option when the user was not the current_user.

1 Answer

Martin Cornejo Saavedra
Martin Cornejo Saavedra
18,132 Points

Nevermind, at the begginig of the project they return the same, the posts, but later get_stream returns your posts and your followed ones.