https://github.com/django/django/blob/stable/1.7.x/django/contrib/admin/utils.py#L141
Therefore, even in a senario where
{{{
def has_delete_permission(self, request, obj=None):
return True
}}}
the user is not able to delete the object, if he doesn't have the
permission explicitly assigned for the class by an auth backend.
A tentative idea would be to replace
`if not user.has_perm(p):`
with
`if admin_site._registry[obj.__class__].has_delete_permission(request,
obj)`
There are though two problems:
- `request` is not defined
- what about `ForeignKey` objects that ought to be deleted but they exist
in the admin panel only as `Inlines`? That is, they don't have their own
`ModelAdmin` class assigned.
--
Ticket URL: <https://code.djangoproject.com/ticket/23869>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted
Comment:
I just noticed this myself yesterday.
--
Ticket URL: <https://code.djangoproject.com/ticket/23869#comment:1>
* cc: cmawebsite@… (added)
Comment:
See also #11383 and #13539
--
Ticket URL: <https://code.djangoproject.com/ticket/23869#comment:2>
* owner: nobody => czpython
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/23869#comment:3>
* status: assigned => new
* owner: czpython =>
--
Ticket URL: <https://code.djangoproject.com/ticket/23869#comment:4>
* owner: nobody => milkomeda
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/23869#comment:3>
* version: 1.7 => master
--
Ticket URL: <https://code.djangoproject.com/ticket/23869#comment:4>
* has_patch: 0 => 1
Comment:
https://github.com/django/django/pull/9985 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/23869#comment:5>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/23869#comment:6>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"0eca99dadeed76bf0ac1a3cf4b62926ae5717319" 0eca99d]:
{{{
#!CommitTicketReference repository=""
revision="0eca99dadeed76bf0ac1a3cf4b62926ae5717319"
[2.1.x] Fixed #23869 -- Made ModelAdmin.get_deleted_objects() use
has_delete_permission() for permissions checking.
Backport of 3eb9127678e292ef2645b632199f3e9c876ad999 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23869#comment:7>
Comment (by Tim Graham <timograham@…>):
In [changeset:"3eb9127678e292ef2645b632199f3e9c876ad999" 3eb9127]:
{{{
#!CommitTicketReference repository=""
revision="3eb9127678e292ef2645b632199f3e9c876ad999"
Fixed #23869 -- Made ModelAdmin.get_deleted_objects() use
has_delete_permission() for permissions checking.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23869#comment:8>