How to separate models in different modules in Django admin's index?
In order to separate models in different modules in Django admin's index, you can follow these steps:
Create a new Python package within your Django app for each module you want to separate the models into. This can be done by creating a new folder within your app directory and adding an empty
__init__.py
file to it.Move the models that you want to separate into their own module into the newly created package.
Create an
admin.py
file within the package and register the models that you want to be displayed separately in the admin index.Import the models from their new locations in the
admin.py
file and then register them with the admin site using theadmin.site.register()
method.Now, when you access the Django admin interface, you should see the models from the different modules displayed separately in the admin index.
I hope this helps!