Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# Imports
3from django.contrib import admin
5# Exports
7__all__ = (
8 "BaseAuditModelAdmin",
9)
11# Models
14class BaseAuditModelAdmin(admin.ModelAdmin):
15 """Base admin class for models implementing the ``AuditMixin``."""
17 def save_model(self, request, obj, form, change):
18 """Use the ``audit()`` method of the instance to save audit data before continuing with saving the model."""
19 obj.audit(request.user, commit=False)
21 super().save_model(request, obj, form, change)