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!
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
Christopher Gunawan
10,754 PointsI don't quite understand the dynamics of this inheritance
If my web app (templates and views) are calling the Step model, how does it know the return the Text.content? If Text inherits from Step, shouldn't Step.content fail?
1 Answer

Richard Li
9,751 PointsStep is abstract right? so it is technically not a stand-alone model to use any more. It can only work as a structure for other models.
For the model that created on Step like Text, it will be an stand-alone model who has a table in the database and all the attribute and method of Step plus its own.
As said in the Django Docs:
Abstract base classes are useful when you want to put some common information into a number of other models.
You write your base class and put abstract=True in the Meta class.
This model will then not be used to create any database table. Instead, when it is used as a base class for other models, its fields will be added to those of the child class.

Christopher Gunawan
10,754 PointsThanks!!
Christopher Gunawan
10,754 PointsChristopher Gunawan
10,754 PointsFor example:
You can't query Step anymore right? You want all Text now, not Steps. If Text inherits from Step and now the other way around, how does this still work?