In my admin.py
I have
class LogEntryAdmin(admin.ModelAdmin):
readonly_fields = (
'user', 'content_type_id', 'object_id', 'object_repr',
'action_flag', 'change_message'
)
def has_add_permission(self, request, obj=None):
return False
def has_delete_permission(self, request, obj=None):
return False
and
admin.site.register(LogEntry, LogEntryAdmin)
While I figured out adding 'user'
rather than 'user_id'
, I can't figure out what to add instead of 'content_type_id'
to make the content type read only.