Skip to content

Instantly share code, notes, and snippets.

@z4none
Created March 28, 2020 12:07
Show Gist options
  • Select an option

  • Save z4none/77485e7d5efa14eabfe5ac6f3e1b657a to your computer and use it in GitHub Desktop.

Select an option

Save z4none/77485e7d5efa14eabfe5ac6f3e1b657a to your computer and use it in GitHub Desktop.
view django models.LogEntry in admin, disable create / edit / delete
class LogEntryAdmin(admin.ModelAdmin):
list_display = ('action_time', 'user', 'object_repr', 'action_flag')
list_per_page = 20
list_display_links = None
search_fields = ['=user__username', ]
fieldsets = [(None, {'fields': ()}), ]
def has_add_permission(self, request):
return False
def has_delete_permission(self, request, obj=None):
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment