I use this snippet to show several fields in my admin backend as readonly, but as noticed in the comments, it does not work on stackedinline/tabularinline. Is there any other way to achieve this? I have a list of objects attached to a model and just want to show it in the model’s details view without the possibility to change values.
Share
If you are running Django 1.3 or later; there’s an attribute named ModelAdmin.readonly_fields which you could use.
InlineModelAdmininherits fromModelAdmin, so you should be able to use it from your inline subclass.