Hide keyboard shortcuts

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 

2 

3from django.contrib import admin 

4 

5# Exports 

6 

7__all__ = ( 

8 "BaseAuditModelAdmin", 

9) 

10 

11# Models 

12 

13 

14class BaseAuditModelAdmin(admin.ModelAdmin): 

15 """Base admin class for models implementing the ``AuditMixin``.""" 

16 

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) 

20 

21 super().save_model(request, obj, form, change)