Source code for superdjango.db.audit.admin
# Imports
from django.contrib import admin
# Exports
__all__ = (
"BaseAuditModelAdmin",
)
# Models
[docs]class BaseAuditModelAdmin(admin.ModelAdmin):
"""Base admin class for models implementing the ``AuditMixin``."""
[docs] def save_model(self, request, obj, form, change):
"""Use the ``audit()`` method of the instance to save audit data before continuing with saving the model."""
obj.audit(request.user, commit=False)
super().save_model(request, obj, form, change)