Skip to main content

Track Django Model Objects over time

Project description

Model Tracker

Track model object changes over time so that you know who done what.


  • Install the package
pip install django-model-tracker
  • Add Application to your project's INSTALLED_APPs
  • Add the following line to your
import ModelTracker
urlpatterns = patterns('',
url(r'^track/', include('ModelTracker.urls')),
  • Run Migrations
   python migrate ModelTracker 
  • Add the following line to your file
from ModelTracker import Tracker
  • Convert each Model you want to track to inhert from Tracker.ModelTracker instead of models.Model

Old Code

   class Employee(models.Model):

New Code

 class Employee(Tracker.ModelTracker):
  • For each save() call, add the user the username
    • Old Code
 * New Code
  • Starting from version of 0.5, you can pass a event_name parameter to mark change as an event

    • New Code
       emp=Employee(),event_name="Created the user")

Using The Middleware

You can add ModelTracker.middleware.ModelTrackerMiddleware to your Middleware classes to get the username automatically from the request.


Note: If you pass username as None then the change won't be saved.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

DjangoModelTracker-1.3.9.tar.gz (59.0 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page