Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed ValueError when adding a notice_setting in admin panel

  • Loading branch information...
commit a4acb9c73a4fe5b47ad3e6b09743fb1c1abe646f 1 parent 80d30a7
Andrew Halligan authored
2  notification/backends/__init__.py
@@ -33,5 +33,5 @@ def load_backends():
33 33 # add the backend label and an instantiated backend class to the
34 34 # backends list.
35 35 backend_instance = getattr(mod, backend_class)(medium_id, spam_sensitivity)
36   - backends.append(((medium_id, label), backend_instance))
  36 + backends.append(((str(medium_id), label), backend_instance))
37 37 return dict(backends)
4 notification/models.py
@@ -99,7 +99,7 @@ def for_user(cls, user, notice_type, medium):
99 99 try:
100 100 return cls._default_manager.get(user=user, notice_type=notice_type, medium=medium)
101 101 except cls.DoesNotExist:
102   - default = (NOTICE_MEDIA_DEFAULTS[medium] <= notice_type.default)
  102 + default = (NOTICE_MEDIA_DEFAULTS[str(medium)] <= notice_type.default)
103 103 setting = cls(user=user, notice_type=notice_type, medium=medium, send=default)
104 104 setting.save()
105 105 return setting
@@ -109,7 +109,7 @@ def get_notification_setting(user, notice_type, medium):
109 109 try:
110 110 return NoticeSetting.objects.get(user=user, notice_type=notice_type, medium=medium)
111 111 except NoticeSetting.DoesNotExist:
112   - default = (NOTICE_MEDIA_DEFAULTS[medium] <= notice_type.default)
  112 + default = (NOTICE_MEDIA_DEFAULTS[str(medium)] <= notice_type.default)
113 113 setting = NoticeSetting(user=user, notice_type=notice_type, medium=medium, send=default)
114 114 setting.save()
115 115 return setting

0 comments on commit a4acb9c

Please sign in to comment.
Something went wrong with that request. Please try again.