Permalink
Browse files

Fixed ValueError when adding a notice_setting in admin panel

  • Loading branch information...
nearlyfreeapps committed Oct 25, 2011
1 parent 80d30a7 commit a4acb9c73a4fe5b47ad3e6b09743fb1c1abe646f
Showing with 3 additions and 3 deletions.
  1. +1 −1 notification/backends/__init__.py
  2. +2 −2 notification/models.py
@@ -33,5 +33,5 @@ def load_backends():
# add the backend label and an instantiated backend class to the
# backends list.
backend_instance = getattr(mod, backend_class)(medium_id, spam_sensitivity)
- backends.append(((medium_id, label), backend_instance))
+ backends.append(((str(medium_id), label), backend_instance))
return dict(backends)
View
@@ -99,7 +99,7 @@ def for_user(cls, user, notice_type, medium):
try:
return cls._default_manager.get(user=user, notice_type=notice_type, medium=medium)
except cls.DoesNotExist:
- default = (NOTICE_MEDIA_DEFAULTS[medium] <= notice_type.default)
+ default = (NOTICE_MEDIA_DEFAULTS[str(medium)] <= notice_type.default)
setting = cls(user=user, notice_type=notice_type, medium=medium, send=default)
setting.save()
return setting
@@ -109,7 +109,7 @@ def get_notification_setting(user, notice_type, medium):
try:
return NoticeSetting.objects.get(user=user, notice_type=notice_type, medium=medium)
except NoticeSetting.DoesNotExist:
- default = (NOTICE_MEDIA_DEFAULTS[medium] <= notice_type.default)
+ default = (NOTICE_MEDIA_DEFAULTS[str(medium)] <= notice_type.default)
setting = NoticeSetting(user=user, notice_type=notice_type, medium=medium, send=default)
setting.save()
return setting

0 comments on commit a4acb9c

Please sign in to comment.