From 03067aa2b7979ff6af21ca9a2b582d67fc88deb0 Mon Sep 17 00:00:00 2001 From: Resul Alkan Date: Fri, 13 Oct 2017 16:53:15 +0300 Subject: [PATCH] fixed root_obj in nested inlines --- djrulengine/admin.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/djrulengine/admin.py b/djrulengine/admin.py index a24a128..454114d 100644 --- a/djrulengine/admin.py +++ b/djrulengine/admin.py @@ -1,6 +1,5 @@ from django import forms from django.contrib import admin -from django.core.urlresolvers import resolve from nested_inline.admin import ( NestedTabularInline, NestedStackedInline, NestedModelAdmin) from .models import RuleContext, Rule, Condition, ContextValue @@ -22,15 +21,8 @@ class ConditionInline(NestedTabularInline): fk_name = 'rule' extra = 1 - def get_rule_context_from_request(self, request): - resolved = resolve(request.path_info) - if resolved.args: - return RuleContext.objects.get(pk=resolved.args[0]) - return None - def get_formset(self, request, obj=None, **kwargs): - parent = self.get_rule_context_from_request(request) - self.form.rule_context = parent + self.form.rule_context = self.root_obj return super(ConditionInline, self).get_formset(request, obj, **kwargs)