\r
*Defaults to*: 'notification', as in django-notification.\r
\r
+ 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.\r
+\r
If you already have a notifier application with the default name in the installed applications\r
but you do not want it to be used by this application, set the option to None.\r
\r
name = name + '.models'
__import__(name)
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)
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."