I found the reason:

https://github.com/django/django/commit/27f5b0aff3442e5c25e84972dff4f5fe1edd4e68

at this line (1962):

if not inline.has_change_permission(request, obj):

an empty ParentModel is given as `obj` instead of None.

Is this a new behavior or a bug?

Thanks!

Andrea Angelini

*Zap 15*
Tailored web solutions
www.zap15.com


On Tue, Dec 18, 2018 at 3:58 PM Andrea <[email protected]> wrote:

> Hi everyone,
>
> could anyone confirm the following situation?
>
> I have a problem with the method "has_change_permission" of the
> "admin.TabularInline" class for a Model, which has a fk to ParentModel.
>
> If I override that method with the following code:
>
> def has_change_permission(self, request, obj=None):
>     print(type(obj))
>     return super().has_change_permission(request, obj)
>
> When I go to "/admin/foo/parentmodel/add/" to add a new ParentModel in the
> admin panel:
>
> In Django 2.1.3 I get:
>
> <class 'NoneType'>
> <class 'NoneType'>
>
> In Django 2.1.4 I get:
>
> <class 'NoneType'>
> <class 'foo.models.ParentModel'>
> <class 'NoneType'>
>
> Can anyone reproduce the problem?
>
> Thanks!
>
> Andrea Angelini
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAPQ7Y1wDBunmN0QQwg9wyQLQD5kK7rFk%3D_at8jmjY_AmaDO2g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to