Source code for superdjango.db.history.admin

# Imports

from django.contrib import admin

# Exports

__all__ = (
    "BaseHistoryModelAdmin",
)


# Models


[docs]class BaseHistoryModelAdmin(admin.ModelAdmin): """Base class for history admin."""
[docs] def get_fields(self, request, obj=None): return [ "added_dt", "content_type", "object_label", "object_id", "user", "user_name", "verb", "verb_display", ]
[docs] def get_list_display(self, request): return [ "object_label", "added_dt", "content_type", "user", "verb", ]
[docs] def get_list_filter(self, request): return [ "content_type", "user", ]
[docs] def get_readonly_fields(self, request, obj=None): return [ "added_dt", "content_type", "object_label", "object_id", "user", "user_name", "verb", "verb_display", ]
[docs] def has_add_permission(self, request): return False
[docs] def has_delete_permission(self, request, obj=None): # noinspection PyUnresolvedReferences return self.request.user.is_superuser