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 How to Win Friends Show Follower Posts

where do user_id and post_id come from?

Why do we use post_id even though we didn't created one in the model? Kenneth did the same thing for user_id as well. Am I missing something?

1 Answer

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

Hi there, Neslihan Kara! He's setting models.Post.id and models.User.id to be equal to the post_id and user_id that are coming in through the route. That being said, the id on those models is an automatic thing. Each model gets an id in the table in the database. When you create the first post, it will get an id of 1, the second post will get an id of 2 etc. It's what is known as an autoincrementing value.

Hope this helps! :sparkles: