#30097 closed Bug (fixed)
InlineModelAdmin.has_add_permission() broke backwards compatibility by requiring obj argument
Reported by: | Maxim Zemskov | Owned by: | Maxim Zemskov |
---|---|---|---|
Component: | contrib.admin | Version: | 2.1 |
Severity: | Release blocker | Keywords: | contrib.admin, admin, inline |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
InlineModelAdmin.has_add_permission() requires obj argument:
def has_add_permission(self, request, obj): if self.opts.auto_created: return self.has_view_permission(request, obj) return super().has_add_permission(request)
But implementation of InlineModelAdmin._has_add_permission() says obj will be required in django 3.0:
def _has_add_permission(self, request, obj): # RemovedInDjango30Warning: obj will be a required argument. args = get_func_args(self.has_add_permission) return self.has_add_permission(request, obj) if 'obj' in args else self.has_add_permission(request)
So, code will crush at self.has_add_permission(request)
in return statement with missing 1 required positional argument: 'obj'
.
Change History (8)
comment:2 by , 6 years ago
Cc: | added |
---|---|
Severity: | Normal → Release blocker |
Triage Stage: | Unreviewed → Accepted |
This looks related to #27991. The new test case on the PR looks right and fails without the patch, so pending review I'm going to accept this as a Release Blocker on v2.1.
comment:3 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 6 years ago
Cc: | removed |
---|---|
Summary: | InlineModelAdmin.has_add_permission() requires obj argument → InlineModelAdmin.has_add_permission() broke backwards compatibility by requiring obj argument |
Triage Stage: | Accepted → Ready for checkin |
Note:
See TracTickets
for help on using tickets.
PR