Management commands

django-reversion includes a number of management commands.


Creates an initial revision for all registered models in your project. It should be run after installing django-reversion, or registering a new model with django-reversion.

./ createinitialrevisions
./ createinitialrevisions your_app.YourModel --comment="Initial revision."
./ createinitialrevisions your_app.YourModel --meta="{\"your_app.RevisionMeta\": {\"hello\": \"world\"}}"

Run ./ createinitialrevisions --help for more information.


For large databases, this command can take a long time to run.


Deletes old revisions. It can be run regularly to keep revision history manageable.

./ deleterevisions
# keep any changes from last 30 days
./ deleterevisions your_app.YourModel --days=30
# keep 30 most recent changes for each item.
./ deleterevisions your_app.YourModel --keep=30
# Keep anything from last 30 days and at least 3 from older changes.
./ deleterevisions your_app.YourModel --keep=3 --days=30

Run ./ deleterevisions --help for more information.


With no arguments, this command will delete your entire revision history! Read the command help for ways to limit which revisions should be deleted.