Tools for logging changes made from Django admin
Project description
django-admin-blame
django-admin-blame is a Django app providing mixins for tracking date and author of model changes from django admin.
Description
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
None
.
Installation
pip install django-admin-blame
Working example is in testproject.testapp
.
- Enable middleware in django settings:
MIDDLEWARE.append('admin_log.middleware.AdminLogMiddleware')
- Add model mixin to your models:
from django.db import models from admin_log.models import AdminLogMixin class Subject(AdminLogMixin, models.Model): title = models.CharField(max_length=50) content = models.TextField()
- Add admin mixin to corresponding model admin:
from django.contrib import admin from admin_log.admin import AdminLogMixin from testproject.testapp import models @admin.register(models.Subject) class SubjectAdmin(AdminLogMixin, admin.ModelAdmin): pass
Now you have readonly fields with date and author of last revision in admin "edit" page.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django_admin_blame-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bdc210487be6907e93c7fbc2f109bcfbd5a96cedf47da562a056f5013d14a6c |
|
MD5 | 2e99ff6dfc427b26a53bcadeb95283b1 |
|
BLAKE2b-256 | 113f36c1c15dfc5362cb8fd4eeaba4f7581d1d53f1dca7d5e6d357fbaec8ffc5 |