Skip to content

Commit

Permalink
Merge pull request #2 from admetricks/update-compat-django-153744279
Browse files Browse the repository at this point in the history
[#153744279] Update compatibility with django >=1.9
  • Loading branch information
vitorohe authored Dec 20, 2017
2 parents 2fce8d1 + 9440faa commit 792abd1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions nested_inline/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def add_view(self, request, form_url='', extra_context=None):
form_validated = False
new_object = self.model()
prefixes = {}
for FormSet, inline in zip(self.get_formsets(request), inline_instances):
for FormSet, inline in self.get_formsets_with_inlines(request):
prefix = FormSet.get_default_prefix()
prefixes[prefix] = prefixes.get(prefix, 0) + 1
if prefixes[prefix] != 1 or not prefix:
Expand All @@ -180,7 +180,7 @@ def add_view(self, request, form_url='', extra_context=None):
if self.all_valid_with_nesting(formsets) and form_validated:
self.save_model(request, new_object, form, False)
self.save_related(request, form, formsets, False)
self.log_addition(request, new_object)
self.log_addition(request, new_object, '')
return self.response_add(request, new_object)
else:
# Prepare the dict of initial data from the request.
Expand All @@ -195,7 +195,7 @@ def add_view(self, request, form_url='', extra_context=None):
initial[k] = initial[k].split(",")
form = ModelForm(initial=initial)
prefixes = {}
for FormSet, inline in zip(self.get_formsets(request), inline_instances):
for FormSet, inline in self.get_formsets_with_inlines(request):
prefix = FormSet.get_default_prefix()
prefixes[prefix] = prefixes.get(prefix, 0) + 1
if prefixes[prefix] != 1 or not prefix:
Expand Down Expand Up @@ -227,7 +227,7 @@ def add_view(self, request, form_url='', extra_context=None):
context = {
'title': _('Add %s') % force_text(opts.verbose_name),
'adminform': adminForm,
'is_popup': "_popup" in request.REQUEST,
'is_popup': "_popup" in request.get_full_path(),
'show_delete': False,
'media': media,
'inline_admin_formsets': inline_admin_formsets,
Expand Down Expand Up @@ -269,7 +269,7 @@ def change_view(self, request, object_id, form_url='', extra_context=None):
form_validated = False
new_object = obj
prefixes = {}
for FormSet, inline in zip(self.get_formsets(request, new_object), inline_instances):
for FormSet, inline in self.get_formsets_with_inlines(request, new_object):
prefix = FormSet.get_default_prefix()
prefixes[prefix] = prefixes.get(prefix, 0) + 1
if prefixes[prefix] != 1 or not prefix:
Expand All @@ -291,7 +291,7 @@ def change_view(self, request, object_id, form_url='', extra_context=None):
else:
form = ModelForm(instance=obj)
prefixes = {}
for FormSet, inline in zip(self.get_formsets(request, obj), inline_instances):
for FormSet, inline in self.get_formsets_with_inlines(request, obj):
prefix = FormSet.get_default_prefix()
prefixes[prefix] = prefixes.get(prefix, 0) + 1
if prefixes[prefix] != 1 or not prefix:
Expand Down Expand Up @@ -325,7 +325,7 @@ def change_view(self, request, object_id, form_url='', extra_context=None):
'adminform': adminForm,
'object_id': object_id,
'original': obj,
'is_popup': "_popup" in request.REQUEST,
'is_popup': "_popup" in request.get_full_path(),
'media': media,
'inline_admin_formsets': inline_admin_formsets,
'errors': helpers.AdminErrorList(form, formsets),
Expand Down

0 comments on commit 792abd1

Please sign in to comment.