开发者

Make django admin logEntry read only?

开发者 https://www.devze.com 2023-01-04 23:54 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消