Tuesday, May 28, 2019

How to disable the the Delete button

Django 1.11 and Python 3.6 but upgrading to Django 2.2 (slowly)

Currently I use a get_readonly_fields callable in the Admin as
documented[1]. The callable determines whether request.user is allowed
to edit the editable fields or not. This works well.

However, the readonly user can still see/use the Delete button.

The abovementioned callable doesn't make their own records readonly so
those users do need change (edit) permissions. Therefore I cannot use
permissions to solve the problem.

Can anyone suggest an approach?

Thanks

Mike

[1]
https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_readonly_fields


--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/cda47e29-3d0a-20a2-be49-9d2a1cc5c7d7%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment