Skip to content
This repository has been archived by the owner on Aug 16, 2019. It is now read-only.

Track activities on your models for displaying the site activity in your Django projects.

Notifications You must be signed in to change notification settings

emencia/emencia-django-tracking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Emencia Django Tracking

The problematic was :

I wrote some articles, and updated many pages on my Django website, how can I inform my visitors of these updates ?

Emencia.django.tracking allows you to track the activities of your models and display them on a timeline without changing the models' code.

Better than a long speech, here is a list of the main features :

  • No need to change your models.
  • Highly customizable.
  • Views and template tags to display the activities.

You can retrieve the last sources from http://github.com/Fantomas42/emencia-django-tracking and run the installation script

$> python setup.py install

or use pip

$> pip install -e git://github.com/Fantomas42/emencia-django-tracking.git#egg=emencia.django.tracking

Then register emencia.django.tracking and contenttypes in the INSTALLED_APPS section of your project's settings.

>>> INSTALLED_APPS = (
...   # Your favorites apps
...   'django.contrib.contenttypes',
...   'emencia.django.tracking',)

Now create a python module somewhere in your project, for example tracking.py in your project directory (let's suppose it is called "project"), and add something like the following line to your project's settings :

>>> TRACKING_REGISTRY = 'project.tracking'

In the tracking.py module we will register the models we want to track. Imagine we have a model named News with a description and title field.

>>> from emencia.django.tracking import tracking
>>> from emencia.django.tracking import TrackingOptions
>>>
>>> from myapp.models import News
>>>
>>> class NewsletterTracking(TrackingOptions):
>>>   description_fields = ('title', 'content',)
>>>
>>> tracking.register(Newsletter, NewsletterTracking)

In your project urls.py add this following line to serve the views packaged in the app.

>>> url(r'^tracking/', include('emencia.django.tracking.urls')),

This urlset provides many views to display these activities :

/
Display the latest activity of each model instance tracked in a recent period.
/all/
Display all the activities tracked.
/recents/
Display all the recent activities tracked.
/inserts/
Display all the creations of models tracked.
/recent_inserts/
Display the recent creations of models tracked.
/changes/
Display all the changes of models tracked.
/recent_changes/
Display the recent changes of models tracked.
/uniques/
Display all the latest activity of each model instance tracked.

Now you can run a syncdb to install the models into your database.

About

Track activities on your models for displaying the site activity in your Django projects.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages