diff --git a/nested_inline/admin.py b/nested_inline/admin.py index f9cd506..6fc86db 100644 --- a/nested_inline/admin.py +++ b/nested_inline/admin.py @@ -76,10 +76,10 @@ def add_nested_inline_formsets(self, request, inline, formset, depth=0): if request.method == 'POST' and any(s.startswith(prefix) for s in request.POST.keys()): nested_formset = InlineFormSet(request.POST, request.FILES, instance=form.instance, - prefix=prefix, queryset=nested_inline.queryset(request)) + prefix=prefix, queryset=nested_inline.get_queryset(request)) else: nested_formset = InlineFormSet(instance=form.instance, - prefix=prefix, queryset=nested_inline.queryset(request)) + prefix=prefix, queryset=nested_inline.get_queryset(request)) nested_formsets.append(nested_formset) if nested_inline.inlines: self.add_nested_inline_formsets(request, nested_inline, nested_formset, depth=depth+1) @@ -173,7 +173,7 @@ def add_view(self, request, form_url='', extra_context=None): formset = FormSet(data=request.POST, files=request.FILES, instance=new_object, save_as_new="_saveasnew" in request.POST, - prefix=prefix, queryset=inline.queryset(request)) + prefix=prefix, queryset=inline.get_queryset(request)) formsets.append(formset) if inline.inlines: self.add_nested_inline_formsets(request, inline, formset) @@ -201,7 +201,7 @@ def add_view(self, request, form_url='', extra_context=None): if prefixes[prefix] != 1 or not prefix: prefix = "%s-%s" % (prefix, prefixes[prefix]) formset = FormSet(instance=self.model(), prefix=prefix, - queryset=inline.queryset(request)) + queryset=inline.get_queryset(request)) formsets.append(formset) if hasattr(inline, 'inlines') and inline.inlines: self.add_nested_inline_formsets(request, inline, formset) @@ -276,7 +276,7 @@ def change_view(self, request, object_id, form_url='', extra_context=None): prefix = "%s-%s" % (prefix, prefixes[prefix]) formset = FormSet(request.POST, request.FILES, instance=new_object, prefix=prefix, - queryset=inline.queryset(request)) + queryset=inline.get_queryset(request)) formsets.append(formset) if hasattr(inline, 'inlines') and inline.inlines: self.add_nested_inline_formsets(request, inline, formset) @@ -297,7 +297,7 @@ def change_view(self, request, object_id, form_url='', extra_context=None): if prefixes[prefix] != 1 or not prefix: prefix = "%s-%s" % (prefix, prefixes[prefix]) formset = FormSet(instance=obj, prefix=prefix, - queryset=inline.queryset(request)) + queryset=inline.get_queryset(request)) formsets.append(formset) if hasattr(inline, 'inlines') and inline.inlines: self.add_nested_inline_formsets(request, inline, formset) diff --git a/nested_inline/templates/admin/edit_inline/tabular-nested.html b/nested_inline/templates/admin/edit_inline/tabular-nested.html index d071e03..de66d12 100644 --- a/nested_inline/templates/admin/edit_inline/tabular-nested.html +++ b/nested_inline/templates/admin/edit_inline/tabular-nested.html @@ -1,4 +1,5 @@ {% load i18n admin_static admin_modify %} +{% load cycle from future %}
{% with recursive_formset=inline_admin_formset stacked_template='admin/edit_inline/stacked-nested.html' tabular_template='admin/edit_inline/tabular-nested.html'%}