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 The C and R of CRUD

Oliver Jiang
Oliver Jiang
14,123 Points

Creating an entry for a relationship

when creating an entry for the relationship using animal_id=1, is the first argument always the foreign key?

1 Answer

Hey there Oliver Jiang! In this case, when creating a Log for an animal, it takes the 2 kwargs. The animal_id and the notes. It is best practice to enter these in the order that they are listed out in the class, but they could be entered in any order. e.g. lion.Logbook(notes="great pouncer", animal_id=1) will produce the same result.

Hope this helps!