A
A
Andrey Salnikov2018-04-14 07:47:42
Django
Andrey Salnikov, 2018-04-14 07:47:42

Where to store abstract models in Django?

Sorry for such a dumb question.
There are 3 applications: catalog, pages, product (categories, static pages, products respectively).
For models in these applications, I want to add the same lines: title, description, keywords.
So: where to store this abstract model? In one of the applications or in some separate place?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Vorobyov, 2018-04-21
@alex_vv

Theoretically, you can store it anywhere.
In practice, there are three options:
1. If this is a one-time project, few models - in the same models.py
2. One-time project, many models, I want to organize everything - abstract models can be stored, for example, in a separate abstracts.py file and imported into models .py
3. Abstract models are reused - create a separate application for them and store only abstract models in models.py, then import them into any project.
Complete freedom of action :-)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question