﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
30050	InlineModelAdmin.has_change_permission() incorrectly called with non-None obj during add	Andrea Angelini	nobody	"Fine with Django 2.1.3, bug with Django 2.1.4.

If I have an admin Inline of a `Model`, with fk to a `ParentModel`, when I try to add a new `ParentModel` in the admin panel (""/admin/foo/parentmodel/add/""), the Inline `has_change_permission` is called 3 times instead of 2, after this commit:

https://github.com/django/django/commit/27f5b0aff3442e5c25e84972dff4f5fe1edd4e68

at line 1962 `has_change_permission` is passed an `obj` that is not `None`.

Before this commit, `obj` was `None` both of the times, now it's `None` the first time, an empty instance of `ParentModel` the second time, and `None` the third time.

Line 1962 should be something like:

permission_obj = obj if change else None
if not inline.has_change_permission(request, permission_obj):"	Bug	closed	contrib.admin	2.1	Release blocker	fixed			Accepted	1	0	0	0	0	0
