django-versions

A Django application to enable versioning of data stored in Django models
Download

django-versions Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Publisher Name:
  • Nowell Strite
  • Publisher web site:
  • http://github.com/nowells/

django-versions Tags


django-versions Description

A Django application to enable versioning of data stored in Django models django-versions is a Django app that allows you to version the data stored in django models seamlessly. To get started all you need to do is to set VERSIONS_REPOSITORIES variable in your settings and configure the repositories you would like to use, then just subclass your Model from VersionsModel and start saving data:from django.db import modelsfrom versions.models import VersionsModelclass MyModel(VersionsModel): text = models.TextField()InstallationInstalling django-versionsIf your are installing from source, you just need to run the following command from the base of the django-versions source tree:python setup.py installIf you want to install the package without checking out the source you should run:pip install http://github.com/nowells/django-versions/tarball/v1.0.0# OR if you don't have pip installed (you should definitely check out pip)easy_install http://github.com/nowells/django-versions/tarball/v1.0.0For the time being, we need to patch Django to allow us to gain access to the related model from Manager classes. There is a patch included at the root of the source tree django.patch that includes the required changes. To patch django, go to the root of your checkout of django 1.1.X and run:patch -p0 < /path/to/django-versions/django.patchAdd VERSIONS_REPOSITORIES to your settings file, pointing to the location where you would like django-versions to create and store your model history:VERSIONS_REPOSITORIES = { 'default': { 'backend': 'versions.backends.hg', 'local': '/path/to/my/projects/model/history', } }Enabling Version ManagementInstall the VersionsMiddleware:MIDDLEWARE_CLASSES = ( ... 'versions.middleware.VersionsMiddleware', ... )Or handle enabling editing of Versioned models manually:from versions.base import revision@revision.commit_on_successdef my_editing_function(request): m = MyModel.objects.get(pk=1) m.save()def my_other_editing_function(request): with revision: m = MyModel.objects.get(pk=1) m.save() Requirements: · Python · Django · Mercurial


django-versions Related Software