Issue
What I've been asked create is an admin page with the following layout:
Fieldset 1 name
- Section 1 name
- field 1
- field 2
- Section 1 name
Fieldset 2 name
- Section 2 name
- field 3
- Section 2 name
and so on.
I can create the fieldsets with ModelAdmin.fieldsets obviously, but its the inner grouping or "Sections" that I'm having difficulty with. The fields to display all belong to the same model, so I can't achieve this with Inlines (or at least I believe I can't).
I'm pretty sure the only way to achieve what I want is to create a custom template and to by pass Django's default loveliness but I'd ideally like to extend the Django Admin because this Fieldset -> Section -> fields layout will be required for several models and I don't want to have to manually generate forms & templates for each model, if I can help it.
Could anyone point me in the right direction to achieve the above layout?
Thanks
Solution
Unfortunately you're out of luck, the Django admin does not support nested fieldsets and has no way to output other structural tags, except by customising the templates.
You can have a look at:
http://django-betterforms.readthedocs.org/en/latest/basics.html
It supports nested fieldsets, so this code will help you when you are customising your admin templates.
Answered By - Anentropic
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.