In Django, is it possible to place forms for models in the admin interface into different files per app? The same as can be done for model files.
E.g. instead of:
app/admin.py
class PersonAdmin(admin.ModelAdmin):
[...]
class CarAdmin(admin.ModelAdmin)
[...]
I’d have
app/admin/personadmin.py
class PersonAdmin(admin.ModelAdmin):
[...]
app/admin/caradmin.py
class CarAdmin(admin.ModelAdmin)
[...]
I would like to do this without changing Django code.
It’s just for overview, I know it doesn’t open up new possibilies for the functioning of the site.
Any help is much appreciated!
Have you tried creating an
__init__.pyfile under the admin directory?The contents would look like:
Just follow the instructions you linked to, but replace “models” with “admin”. Try it and see if it works. I’d be surprised if it doesn’t.