After refactoring on the site, four main entities were identified, in which common properties were identified, namely:
- Forum themes (questions)
- Answers to forum topics
Of course, and so it was clear that these entities can have the same data fields, the same methods, etc. But when developing this site, I myself simultaneously study Python and Django. Therefore, the project has the character of chaotic introduction of small ToDo with subsequent refactoring in the study of the best approaches. Therefore, after studying the inheritance capabilities of models in Django, one general abstract data model was identified,
, which has four fields that are repeated in all the above modeled models.
There is one important point here:
A model that is declared abstract will not create a table in the database.
To create an abstract model, you must set the