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:
Install with pip:
pip install django-reversion
.Add
'reversion'
toINSTALLED_APPS
.Run
manage.py migrate
.
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 use the django-reversion API to build version-controlled applications. See django-reversion API.