Opened 7 years ago
Last modified 7 years ago
#30050 closed Bug
admin.TabularInline has_change_permission obj is not None on add — at Initial Version
| Reported by: | Andrea Angelini | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.admin | Version: | 2.1 |
| Severity: | Release blocker | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
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.