I have simple project on Django 1.11.13, that uses ordinary Django's admin
module. Staff user can not delete object while is permitted
(has_delete_permission returns always true).
models.py:
class MyModel(models.Model):
name = models.IntegerField("Value", blank=True, null=True)
admin.py:
@admin.register(MyModel)class MyModelAdmin(admin.ModelAdmin):
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
I created user and logged in. He can create MyModel object (as expected),
can edit (as expected), but can not delete!!
That's what I see if I try to delete it:
Deleting the selected my model would result in deleting related objects,
but your account doesn't have permission to delete the following types of
objects:
my model
What am I doing wrong? How should I give permissions to delete MyModels to
ordinary staff user?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/f2a89d70-b488-4584-8fad-0d5b7a5d20e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.