Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #7898 -- Moved formset media definition to a media property in …

…InlineAdminFormSet display helper and added InlineAdminForm media at the same time. This now properly renders all media associated with the formset and its display helper children. Thanks dima.kozlov for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8057 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 62d9e278d7230f035b3521492c28dd8c1f66147a 1 parent 4379451
@brosner brosner authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 django/contrib/admin/options.py
View
10 django/contrib/admin/options.py
@@ -556,14 +556,13 @@ def change_view(self, request, object_id, extra_context=None):
adminForm = AdminForm(form, self.get_fieldsets(request, obj), self.prepopulated_fields)
media = self.media + adminForm.media
- for fs in inline_formsets:
- media = media + fs.media
inline_admin_formsets = []
for inline, formset in zip(self.inline_instances, inline_formsets):
fieldsets = list(inline.get_fieldsets(request, obj))
inline_admin_formset = InlineAdminFormSet(inline, formset, fieldsets)
inline_admin_formsets.append(inline_admin_formset)
+ media = media + inline_admin_formset.media
context = {
'title': _('Change %s') % opts.verbose_name,
@@ -759,6 +758,13 @@ def __iter__(self):
def fields(self):
for field_name in flatten_fieldsets(self.fieldsets):
yield self.formset.form.base_fields[field_name]
+
+ def _media(self):
+ media = self.formset.media
+ for fs in self:
+ media = media + fs.media
+ return media
+ media = property(_media)
class InlineAdminForm(AdminForm):
"""

0 comments on commit 62d9e27

Please sign in to comment.
Something went wrong with that request. Please try again.