Answer the question
In order to leave comments, you need to log in
How to specify all fields in fields or fieldsets?
I want to combine two fields in the admin panel into fieldsets, but then I have to list all the fields in the first block. And for a model with a large number of fields, this is not desirable at all.
For example, to not list fields ('url', 'title', 'content', 'sites') as in the example:
fieldsets = (
(None, {
'fields': ('url', 'title', 'content', 'sites')
}),
('Advanced options', {
'classes': ('collapse',),
'fields': ('registration_required', 'template_name'),
}),
)
Answer the question
In order to leave comments, you need to log in
This cannot be done with built-in methods, as far as I know. You can override the method Model.get_fieldsets
, which will receive a list of all fields from the model class and form what you need - but this is too perverse in my opinion.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question