Currently i have my models, views, forms in default file.
But i want to have directory structure like
articles
---------models
---------views
---------forms
Books
---------models
---------views
---------forms
Icecreams
---------models
---------views
---------forms
so that i keep separately but i don’t want different app
The directory structure you describe is the individual apps directory structure. If you want it to look like that, you have to make them separate apps. However, you can do something like:
Simply add a
modelsdirectory and deletemodels.py. Then, create a separate.pyfile for each model/group of models you want to separate.Here’s the important part: on each of your models you must add the following to their
Metaclass:Where ‘myapp’, is the main app folder all these models are stored in.
Then, edit
models/__init__.pyand import all your models there, e.g.:However, the models you list as examples are pretty obvious candidates for distinct apps. The approach above is really only for related models. If your models are truly that distinct, they should be individual apps.