Tools for logging changes made from Django admin
django-admin-blame is a Django app providing mixins for tracking date and author of model changes from django admin.
Often it is useful to know date and author of object creation or modification. django-admin-blame provides a django model mixin with fields:
- created (datetime) - timestamp of object creation
- created_by (FK to User) - reference to an admin user who created this object through admin site
- modified (datetime) - timestamp of last object modification
- modified_by (FK to User) - reference to an admin user who made last changes to
this object through admin site. If changes has been made somewhere else,
field value is reset to
pip install django-admin-blame
Working example is in
- Enable middleware in django settings:
- Add model mixin to your models:
from django.contrib.auth.models import AbstractUser from admin_log.models import AdminLogMixin class User(AdminLogMixin, AbstractUser): pass
- Add admin mixin to corresponding model admin:
from django.contrib import admin from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from admin_log.admin import AdminLogMixin from testproject.testapp import models @admin.register(models.User) class UserAdmin(AdminLogMixin, BaseUserAdmin): pass
Now you have readonly fields with date and author of last revision in admin "edit" page.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size django-admin-blame-0.0.4.tar.gz (5.2 kB)||File type Source||Python version None||Upload date||Hashes View|