{{{
def get_inline_instances(self, request, obj=None):
inline_instances = super().get_inline_instances(request, obj)
...
}}}
and the super call is throwing an error in the source code of Django here:
{{{
def get_inline_instances(self, request, obj=None):
inline_instances = []
for inline_class in self.get_inlines(request, obj):
inline = inline_class(self.model, self.admin_site)
if request:
if not (inline.has_view_or_change_permission(request, obj)
or
inline.has_add_permission(request, obj) or
# AT THIS LINE
inline.has_delete_permission(request, obj)):
continue
if not inline.has_add_permission(request, obj):
inline.max_num = 0
inline_instances.append(inline)
return inline_instances
}}}
Haven't had this problem with Django 2.0
--
Ticket URL: <https://code.djangoproject.com/ticket/31098>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Baptiste Mispelon):
This sounds like a duplicate of #29723. Which version of Django do you
have installed exactly?
Could you share the entire code of your `ModelAdmin` definition?
Thanks.
--
Ticket URL: <https://code.djangoproject.com/ticket/31098#comment:1>
* status: new => closed
* resolution: => invalid
Comment:
Support for `InlineModelAdmin.has_add_permission()` methods that don’t
accept `obj` as the second positional argument was deprecated in Django
2.1 and removed in Django 3.0.
We had a small regression in Django 2.1.0 (see #29723), so you should use
Django 2.1.1+.
--
Ticket URL: <https://code.djangoproject.com/ticket/31098#comment:2>
Comment (by Mihai Zamfir):
But what if I want to use Django 3? how do I adapt it?
--
Ticket URL: <https://code.djangoproject.com/ticket/31098#comment:3>
Comment (by felixxm):
You should fix `has_add_permission()` for your inlines.
--
Ticket URL: <https://code.djangoproject.com/ticket/31098#comment:4>
Comment (by Mihai Zamfir):
Thanks for the response. However, that's not something I can control. As
in the snippet above, I'm just calling the parent method, the super call
errors.
{{{
def get_inline_instances(self, request, obj=None):
inline_instances = super().get_inline_instances(request, obj)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31098#comment:5>
Comment (by felixxm):
Replying to [comment:5 Mihai Zamfir]:
> Thanks for the response. However, that's not something I can control. As
in the snippet above, I'm just calling the parent method, the super call
errors.
>
> {{{
> def get_inline_instances(self, request, obj=None):
> inline_instances = super().get_inline_instances(request, obj)
> }}}
Of course you can, your class that inherits from `ModelAdmin` has inlines
with a custom `has_add_permission()` method that doesn't accept `obj`
argument. Please use one of
[https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels
support channels].
--
Ticket URL: <https://code.djangoproject.com/ticket/31098#comment:6>