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 trialRey Adronico Baguio
13,672 PointsWhy was it important for us to put a quotations around "Writer" when we assigned it as a Foreign Key to Article?
Couldn't we just put the Writer Model first? And how did putting quotes around them fix the order of writing the model?
1 Answer
Chris Freeman
Treehouse Moderator 68,457 PointsFrom the docs ForeignKey
If you need to create a relationship on a model that has not yet been defined, you can use the name of the model, rather than the model object itself
Since Writer is defined after Article, it is not yet defined when the ForeignKey is defined. The quotes tell Django to look for the Writer model later on in the code.