Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Add `reversion_compare` compatabilbty. #605

wants to merge 2 commits into from

2 participants


No description provided.


I'm not sure if we want to start including a bunch of code in Mezzanine particularly to support reversion. I've started a discussion for this on the mailing list:


We've actually removed the USE_REVERSION setting in the latest version. There were several areas where it still didn't function correctly.

Your contributions started working towards correcting some of these (thank you), but it's clear that we would have needed to add more and more code into Mezzanine itself for this to be a complete solution, which I think is the wrong approach.

What we should be able to do is get it to work by simply unregistering admin classes and registering custom classes from within your own project (that include reversion compatibility). Perhaps this would make for a good separate app called mezzanine-reversion, which includes everything needed to get this to work. Would you be interested in working on something like that?

I'm going to close these pull requests for now. Thanks again.

@stephenmcd stephenmcd closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 20, 2013
  1. @pahaz
Commits on Mar 21, 2013
  1. @pahaz

    fix import

    pahaz authored
This page is out of date. Refresh to see the latest.
Showing with 30 additions and 4 deletions.
  1. +30 −4 mezzanine/core/
34 mezzanine/core/
@@ -10,7 +10,8 @@
from mezzanine.conf import settings
from mezzanine.core.forms import DynamicInlineAdminForm
from mezzanine.core.models import (Orderable, SitePermission,
from mezzanine.utils.urls import admin_url
from mezzanine.utils.models import get_user_model
@@ -55,10 +56,35 @@ class BaseDisplayableAdmin(admin.ModelAdmin):
if "reversion" in settings.INSTALLED_APPS and settings.USE_REVERSION:
- from reversion import VersionAdmin
- class DisplayableAdmin(BaseDisplayableAdmin, VersionAdmin):
+ if "reversion_compare" in settings.INSTALLED_APPS:
+ from reversion_compare.admin import CompareVersionAdmin as VersionAdmin
+ else:
+ from reversion import VersionAdmin
+ class VersionMixedAdmin(VersionAdmin):
+ compare_exclude = ('keywords', 'site', 'parent', 'comments', 'rating')
+ def compare_site(self, obj_compare):
+ """ compare the foo_bar model field """
+ if obj_compare.value1 != obj_compare.value2:
+ from django.contrib.sites.models import Site
+ from_site = Site.objects.get(id=obj_compare.value1)
+ to_site = Site.objects.get(id=obj_compare.value2)
+ return "Change site id: {0} -> {1}".format(from_site, to_site)
+ return None
+ def compare_status(self, obj_compare):
+ """ compare the foo_bar model field """
+ if obj_compare.value1 != obj_compare.value2:
+ _from = unicode(choice.get(obj_compare.value1))
+ _to = unicode(choice.get(obj_compare.value2))
+ return u"{0} -> {1}".format(_from, _to)
+ return None
+ class DisplayableAdmin(BaseDisplayableAdmin, VersionMixedAdmin):
class DisplayableAdmin(BaseDisplayableAdmin):
Something went wrong with that request. Please try again.