Opened 13 years ago
Last modified 9 years ago
#16862 closed Bug
I'm try to implement object permission on django admin. — at Initial Version
Reported by: | Kidwind | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Normal | Keywords: | permission |
Cc: | kmike84@…, slav0nic0@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
i'm override ModelAdmin for my object permission Backend like this
def has_delete_permission(self, request, obj=None):
opts = self.opts
return request.user.has_perm(opts.app_label + '.' + opts.get_delete_permission(), obj) # pass parm obj
but when i delete the obj,System back to me "Deleting the article 'test' would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:article".
why? i try to find the Root of the problem.
in the django.contrib.admin.utils.get_deleted_objects not pass parm "obj" to detect the permission for related deleted obj.
Django did not provide extension points,I can only change the django source code.
when i try to implement object permission for django admin,What is the best solution,thank you.