I
I
IvanOne2015-10-28 15:28:49
PostgreSQL
IvanOne, 2015-10-28 15:28:49

How to properly design a base for django?

The question is that in the project it is planned to use the operation model, there will be 3-4 more applications in which there will be separate models, these models partially repeat the fields of the operation model and have a one-to-one relationship (operation model = application model), all models have an active attribute that reflects whether the record is considered active, that is, records will not be deleted from the database. But at the same time, if somewhere in the application the entry is deactivated, then the model entry in the operations table is also deactivated. I don’t know if it’s worth using django-polymorphic, will it slow down the system? That is, create the main model of the Operation and from it already make models for other applications. Or, do this for each application with its own model, and associate them with the main "operation" model.
I'm sorry there is no code, because I haven't done it yet, if it's not clear, I'll write even more.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Foo Bar, 2015-10-28
@atomheart

It seems to me that it is better to paint your models everywhere and connect them with OneToOneField.
And in queries of selections, check visibility in one of the models, or update the value in the main table when updating in each model.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question