Permalink
Browse files

new reversion support

  • Loading branch information...
1 parent d6ef8fa commit 8e253348baf91cf34d192e314f8786cd5372d0fc @gugu committed Jun 16, 2012
Showing with 3 additions and 4 deletions.
  1. +3 −4 src/reversion_email/models.py
@@ -1,17 +1,16 @@
"""Database models used by django-reversion-email."""
from django.conf import settings
-from django.db.models import signals
from django.core.mail import EmailMultiAlternatives
from django.core.urlresolvers import NoReverseMatch
from django.template.loader import get_template
from django.template import Context
from django.core import urlresolvers
-from django.contrib.sites.models import Site
import difflib
def send_diff_to_email(sender, instance, **kwargs):
+ from django.contrib.sites.models import Site
versions = sender.objects.filter(content_type=instance.content_type, object_id=instance.object_id).order_by('-id')
html_template = get_template('reversion_email/email.html')
text_template = get_template('reversion_email/email.txt')
@@ -65,5 +64,5 @@ def send_diff_to_email(sender, instance, **kwargs):
email.send()
if hasattr(settings,'MODERATORS'):
- import reversion.models
- signals.post_save.connect(send_diff_to_email, sender = reversion.models.Version)
+ from reversion import post_revision_commit, models
+ post_revision_commit.connect(send_diff_to_email, sender = models.Version)

0 comments on commit 8e25334

Please sign in to comment.