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 trialigsm '
10,440 PointsWhat does question.truefalsequestion mean?
Hi,
When we do the following:
question = question.truefalsequestion
What does it mean? Where do we take truefalsequestion from?
1 Answer
Ryan S
27,276 PointsHi Igor,
That is a good question and was something that I got confused with as well. The thing with multi-table inheritance is that the name of the related models will automatically become a lower-cased attribute of the base Model from which they inherit.
For example, in this case we have a Question model, then 2 models named MultipleChoiceQuestion and TrueFalseQuestion that relate to Question through MTI. So if we get a Question object, we are able to access either type of Question by its lowercased name. I don't remember this being explained in the Django courses. I had to look it up in the docs.
Hope this clears things up.
igsm '
10,440 Pointsigsm '
10,440 PointsExcellent! Thanks a lot! I assumed it too and your explanation makes it totally clear now.