A Django app allowing the tracking of objects field in the admin site.
Django 4.2: See older versions for earlier version of Django.
Add the middleware to also store the current user:
MIDDLEWARE = ( ... "tracking_fields.middleware.cuser.CuserMiddleware", ... )
Add "tracking_fields" to your INSTALLED_APPS settings.
Add the
tracking_fields.decorators.trackdecorator to your models with the fields you want to track as parameters:@track('test', 'm2m') class MyModel(models.Model): test = models.BooleanField('Test', default=True) m2m = models.ManyToManyField(SubModelTest, null=True)Your objects are now tracked. See the admin site for the tracking information.
If you want to track who does the changes, please install the
django-cuserapp.You can also track fields of related objects:
class MyModel(models.Model): test = models.BooleanField('Test', default=True) @track('related__test') class MyOtherModel(models.Model): related = models.ForeignKey(MyModel)You can run the tests with
tox(make sure to havedjango-cuserinstalled).
The change to UUID is a mess to do in a migration. The migrations have thus been squashed. You can either alter your fields by hand and do a fake migration afterward or remove your tracking fields tables and run migrations again:
./manage.py migrate --fake tracking_fields zero ./manage.py migrate tracking_fields
Why does my relationship change create two events ?
Please see https://docs.djangoproject.com/en/1.7/ref/models/relations/#direct-assignment
- Yann FOUILLAT (alias Gagaro) <yann.fouillat@makina-corpus.com>
- GPLv3+
