django-reversion

django-reversion is an extension to the Django web framework that provides version control for model instances.

Features

  • Roll back to any point in a model instance’s history.
  • Recover deleted model instances.
  • Simple admin integration.

Installation

To install django-reversion:

  1. Install with pip: pip install django-reversion.
  2. Add 'reversion' to INSTALLED_APPS.
  3. Run manage.py migrate.

Important

See Compatible Django versions if you’re not using the latest release of Django.

Admin integration

django-reversion can be used to add rollback and recovery to your admin site.

Register your models with a subclass of reversion.admin.VersionAdmin.

from django.contrib import admin
from reversion.admin import VersionAdmin

@admin.register(YourModel)
class YourModelAdmin(VersionAdmin):

    pass

Hint

Whenever you register a model with django-reversion, run createinitialrevisions.

For more information about admin integration, see Admin integration.

Low-level API

You can the django-reversion API to build version-controlled applications. See django-reversion API.