Patrick Samson  committed 30dfc50

Support of django-notification extended from version 0.2.0 to 1.0.

  • Participants
  • Parent commits eb9610b
  • Branches default

Comments (0)

Files changed (3)

File docs/quickstart.rst

     *Defaults to*: 'notification', as in django-notification.
+    Note: django-notification v0.2.0 works with Django version 1.3. As of Django 1.4, switch to at least django-notification v1.0.
     If you already have a notifier application with the default name in the installed applications
     but you do not want it to be used by this application, set the option to None.

File postman/management/

     name = name + '.models'
     notification = sys.modules[name]
+    try:
+        create = notification.NoticeType.create  # django-notification 1.0
+    except AttributeError:
+        create = notification.create_notice_type  # django-notification 0.2.0 (works only with DJ <= 1.3)
     def create_notice_types(*args, **kwargs):
-        notification.create_notice_type("postman_rejection", _("Message Rejected"), _("Your message has been rejected"))
-        notification.create_notice_type("postman_message", _("Message Received"), _("You have received a message"))
-        notification.create_notice_type("postman_reply", _("Reply Received"), _("You have received a reply"))
+        create("postman_rejection", _("Message Rejected"), _("Your message has been rejected"))
+        create("postman_message", _("Message Received"), _("You have received a message"))
+        create("postman_reply", _("Reply Received"), _("You have received a reply"))
     signals.post_syncdb.connect(create_notice_types, sender=notification)

File postman/

             self.assertEqual(mail.outbox[0].to, [email])
         from postman.utils import notification
         if notification and notice_label:
-            notice = notification.Notice.objects.get()
-            self.assertEqual(notice.notice_type.label, notice_label)
+            if hasattr(notification, "Notice"):  # exists for django-notification 0.2.0, but no more in 1.0
+                notice = notification.Notice.objects.get()
+                self.assertEqual(notice.notice_type.label, notice_label)
     def test_notification_rejection_visitor(self):
         "Test notify_users() for rejection, sender is a visitor."