django-reversion-compare

raw JSON →
0.19.2 verified Fri May 01 auth: no python

Add compare view to django-reversion for comparing two versions of a reversion model. Version 0.19.2 supports Python >=3.11 and Django 4.2+. Released irregularly.

pip install django-reversion-compare
error django.core.exceptions.ImproperlyConfigured: The app 'reversion_compare' is not compatible with Django 4.2+
cause Outdated version of django-reversion-compare that doesn't declare Django 4.2 support in its metadata.
fix
Upgrade to django-reversion-compare 0.18.0 or later: pip install --upgrade django-reversion-compare
error AttributeError: 'YourModelAdmin' object has no attribute 'compare_view'
cause Model admin class does not inherit from CompareVersionAdmin.
fix
Change admin class to inherit from CompareVersionAdmin instead of admin.ModelAdmin.
breaking Requires django-reversion 5.0+. Older versions of django-reversion are incompatible.
fix Ensure django-reversion >= 5.0 is installed: pip install 'django-reversion>=5.0'
deprecated The 'reversion_compare.views.revision_diff' function signature changed in 0.17.0. Old calls with positional arguments will break.
fix Use keyword arguments when calling revision_diff. See documentation.
gotcha Model fields that are not registered with reversion (e.g., excluded fields) will not appear in the compare view. Users often expect all fields to be compared.
fix Register all relevant fields with reversion: use reversion.register(YourModel, fields=['field1', 'field2', ...]) or follow_fields.

Enable version comparison in the Django admin for a model registered with django-reversion.

# settings.py
INSTALLED_APPS = [
    ...
    'reversion',
    'reversion_compare',
]

# admin.py
from django.contrib import admin
from reversion_compare.admin import CompareVersionAdmin
from .models import YourModel

class YourModelAdmin(CompareVersionAdmin):
    pass

admin.site.register(YourModel, YourModelAdmin)