Make django admin logEntry read only?
I found this post and it was very useful, but what I need is to make the logEntry
mo开发者_C百科del read-only in the admin interface. Is there a way to achieve that?
Thanks!
Here is the example from the post you mentioned, with the needed change to make the fields read-only:
from django.contrib.admin.models import LogEntry
class LogEntryAdmin(admin.ModelAdmin):
readonly_fields = ('content_type', 'user', 'action_time')
admin.site.register(LogEntry, LogEntryAdmin)
This works only in Django 1.2 so it is possible you will have to upgrade your Django package.
精彩评论