Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Brian Rosner authored July 23, 2008

Showing 1 changed file with 8 additions and 2 deletions. Show diff stats Hide diff stats

  1. 10  django/contrib/admin/options.py
10  django/contrib/admin/options.py
@@ -556,14 +556,13 @@ def change_view(self, request, object_id, extra_context=None):
556 556
 
557 557
         adminForm = AdminForm(form, self.get_fieldsets(request, obj), self.prepopulated_fields)
558 558
         media = self.media + adminForm.media
559  
-        for fs in inline_formsets:
560  
-            media = media + fs.media
561 559
 
562 560
         inline_admin_formsets = []
563 561
         for inline, formset in zip(self.inline_instances, inline_formsets):
564 562
             fieldsets = list(inline.get_fieldsets(request, obj))
565 563
             inline_admin_formset = InlineAdminFormSet(inline, formset, fieldsets)
566 564
             inline_admin_formsets.append(inline_admin_formset)
  565
+            media = media + inline_admin_formset.media
567 566
 
568 567
         context = {
569 568
             'title': _('Change %s') % opts.verbose_name,
@@ -759,6 +758,13 @@ def __iter__(self):
759 758
     def fields(self):
760 759
         for field_name in flatten_fieldsets(self.fieldsets):
761 760
             yield self.formset.form.base_fields[field_name]
  761
+    
  762
+    def _media(self):
  763
+        media = self.formset.media
  764
+        for fs in self:
  765
+            media = media + fs.media
  766
+        return media
  767
+    media = property(_media)
762 768
 
763 769
 class InlineAdminForm(AdminForm):
764 770
     """

0 notes on commit 62d9e27

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