From 14fddfe5415469fda1d0f0a62575e7bdddd16a3d Mon Sep 17 00:00:00 2001 From: pawnhearts Date: Sat, 16 Dec 2023 00:48:34 +0300 Subject: [PATCH] Fix get_inlines method being ignored (#145) --- nested_inline/admin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nested_inline/admin.py b/nested_inline/admin.py index 68daca9..452a6f4 100644 --- a/nested_inline/admin.py +++ b/nested_inline/admin.py @@ -19,9 +19,12 @@ class InlineInstancesMixin(): + def get_inlines(self, request, obj): + return super().get_inlines(request, obj) if hasattr(super(), 'get_inlines') else self.inlines + def get_inline_instances(self, request, obj=None): inline_instances = [] - for inline_class in self.inlines: + for inline_class in self.get_inlines(request, obj): inline = inline_class(self.model, self.admin_site) if request: if VERSION < (2, 1, 0):