The administrator is intended for editing, and not just for viewing (you will not find the permission "view"). In order to achieve what you want, you will have to prohibit adding, deleting and making all fields read-only:
class MyAdmin(ModelAdmin): def has_add_permission(self, request, obj=None): return False def has_delete_permission(self, request, obj=None): return False
(if you forbid change, you will not even see objects)
For some unverified code that tries to automate the installation of all read-only fields, see my answer on the Entire model as read-only
EDIT: also untested, but just looked at my LogEntryAdmin, and it has
readonly_fields = MyModel._meta.get_all_field_names()
I don't know if this will work in all cases.
EDIT: QuerySet.delete () can still massively delete objects. To get around this, provide your own โobjectsโ manager and a corresponding subclass of QuerySet that does not delete - see Overriding QuerySet.delete () in Django
Danny W. Adair Nov 25 '11 at 7:14 2011-11-25 07:14
source share