在我的应用程序中,基于Django 1.9,我有一个user
管理模型的自定义实现,我想允许超过Staff
个用户删除用户。我需要以编程方式处理此权限。
所以我已覆盖has_delete_permission
以允许任何人删除用户:
def has_delete_permission(self, request, obj=None):
return True
但是管理员总是说:
Deleting the user 'usertest@gmail.com' would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:
- user
我该如何解决这个问题?