#8387: Returning a subset of the models fields in ModelAdmin.get_fieldsets only
works when also overriding get_form
--------------------------------------+-------------------------------------
Reporter: jarrow | Owner: nobody
Status: new | Milestone: 1.0
Component: Admin interface | Version: SVN
Resolution: | Keywords:
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Changes (by jarrow):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
I don't know if we want to recommend flatten_fieldsets() for public use.
But if we would this is the much cleaner method to use if you need to
override get_form() just to work around the get_fieldsets() gotcha:
{{{
#!python
from django.contrib.admin.util import flatten_fieldsets
def get_form(self, request, obj=None, **kwargs):
defaults = {
'fields': flatten_fieldsets(self.get_fieldsets(request, obj)),
}
defaults.update(kwargs)
return super(FrontpageImageOptions, self).get_form(request, obj,
**defaults)
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/8387#comment:1>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---