Skip to content

Commit

Permalink
Fix bug if django.contrib.admin precedes nested_admin in INSTALLED_APPS
Browse files Browse the repository at this point in the history
fixes #56, refs #46
  • Loading branch information
fdintino committed Sep 13, 2016
1 parent dfcfbdb commit fa453c0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion nested_admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,16 @@ def __getattr__(self, name):
'__docformat__': 'restructuredtext en',
})

all_valid_patch_modules = [django.forms.formsets]

@monkeybiz.patch(django.forms.formsets)
# If django.contrib.admin.options has already been imported, we'll need to
# monkeypatch all_valid in that module as well
admin_module = sys.modules.get('django.contrib.admin.options')
if admin_module:
all_valid_patch_modules.append(admin_module)


@monkeybiz.patch(all_valid_patch_modules)
def all_valid(original_all_valid, formsets):
"""
Checks validation on formsets, then handles a case where an inline
Expand Down

0 comments on commit fa453c0

Please sign in to comment.