This question is continuation of How to remove Add button in Django admin, for specific Model?
I have realized that my first question was not formulated good, so I tough that it is better that I start new question, that to fix the old one. Because there was already some answers.
So question is how to make Django Model that will be view read only. So that you can not add new, delete old, change current, but that you also do not have button for that on web admin UI.
Solution from first question are all related to fields, but not to whole model.
They all work, in sense that you will not be able to edit those field, but I am not satisfied how they do it.
Current solution are:
- Use
readonly_fields
on all fields from model -> I do not like it because you can click on row to change it, but you can not edit fields. editable=False
on filed definition -> This will not show the field on web admin UI. But you can still click on row, but you will just not see anything, and still have Save button.def has_add_permission(self, request):
-> same as 2- don't give anyone the add permission for this model -> same as 2
Any thoughts ?