Update: Considering the function `delete_view` here
https://github.com/django/django/blob/master/django/contrib/admin/options.py#L1637 it correctly checks the delete permission for the object here https://github.com/django/django/blob/master/django/contrib/admin/options.py#L1644 but then here https://github.com/django/django/blob/master/django/contrib/admin/options.py#L1657 it calls `get_deleted_objects`, which doesn't consider the method ` has_delete_permission` and doesn't get the `request` instance. Thanks for your time, Andrea 2014-11-18 12:25 GMT+01:00 Andrea <andrea.g...@gmail.com>: > Dear all, > > I'm using Django 1.7.1, but I needed a feature that is available only in > the dev version, specifically this one: > > > https://github.com/django/django/commit/504c89e8008c557a1e83c45535b549f77a3503b2 > > I don't think this is related to the problem I have, which is the > following, but I anyway need this link later. > > I didn't assign any class permission to a user X for the model Y through > the admin panel to delete an object, but I've overwritten the following in > my `ModelAdmin` class for the model Y: > > def has_add_permission(self, request): > return True > > def has_change_permission(self, request, obj=None): > return True > > def has_delete_permission(self, request, obj=None): > return True > > def has_module_permission(self, request): > return True > > This doesn't let the user X to delete a model Y instance, and I think the > reason is here: > > > https://github.com/django/django/blob/master/django/contrib/admin/utils.py#L142 > > In my opinion, following the fix I linked at the beginning, this line > should be replaced with something along the following, that is: > > - if not user.has_perm(p): > + if admin_site._registry[obj.__class__].has_delete_permission(request, > obj) > > (this line is wrong, I don't know where to get the `request` from, but I > hope one can get the idea). > > My question is: how can/should I proceed to fix this? > > Thanks! > Andrea > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAAPQ7Y2221t0L%3DReYktbnB%3DDYpmcQzpRR4GncSKgRUpqwoF-qg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.