1π
You should move all the identical code to the app_shared
application and import it from app_company1
and app_company2
.
If have separate tables in the DB is a requirement, then the inventory
and transaction
models should be defined as abstract in app_shared
. app_company1
and app_company2
should create their own corresponding models that derive from the abstract models. This will ensure separate tables are generated in the DB. See this documentation page for more details.
0π
The issue is, between app_company1 and app_company2, everything is identical, same exact models, signals and so on. I have to keep them separate to create their own tables in database. But donβt want to duplicate same code. Is there a way of preventing the duplication?
If you have such code then your design of apps is not perfect. You can try to make one app for app_company
and try to distinguish between records of different companies. That way you can add as many companies as you want without duplicating the code or adding new app for each one of them.
- [Answer]-Django show "It worked" page instead of my project when I start it docker
- [Answer]-Easiest way to concatenate two QuerySets same Model (no order needed)
- [Answer]-How to use foreign key to get related objects?
- [Answer]-Why do we need fields value in Meta class in Django forms?
- [Answer]-Django model for time-table like objects