Skip to content

Commit

Permalink
make medium use a label as identifier
Browse files Browse the repository at this point in the history
this commit uses the backends label from NOTIFICATION_BACKENDS setting
for easier to rearrange backends

Conflicts:
	notification/backends/__init__.py
	pinax/notifications/models.py
  • Loading branch information
sherzberg committed Jun 19, 2015
1 parent d810e4d commit 057a311
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pinax/notifications/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def configure_backends(self, value):
raise ImproperlyConfigured(
"NOTIFICATION_BACKENDS does not contain enough data."
)
backend_instance = load_path_attr(backend_path)(medium_id, spam_sensitivity)
backends.append(((medium_id, label), backend_instance))
backend_instance = load_path_attr(backend_path)(label, spam_sensitivity)
backends.append(((label, label), backend_instance))
return dict(backends)

def configure_get_language_model(self, value):
Expand Down
2 changes: 1 addition & 1 deletion pinax/notifications/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class NoticeSetting(models.Model):

user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_("user"))
notice_type = models.ForeignKey(NoticeType, verbose_name=_("notice type"))
medium = models.CharField(_("medium"), max_length=1, choices=NOTICE_MEDIA)
medium = models.CharField(_("medium"), max_length=100, choices=NOTICE_MEDIA)
send = models.BooleanField(_("send"), default=False)
scoping_content_type = models.ForeignKey(ContentType, null=True, blank=True)
scoping_object_id = models.PositiveIntegerField(null=True, blank=True)
Expand Down
2 changes: 1 addition & 1 deletion pinax/notifications/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ def get_backend_id(backend_name):
from ..models import NOTICE_MEDIA
for bid, bname in NOTICE_MEDIA:
if bname == backend_name:
return bid
return bname
return None

0 comments on commit 057a311

Please sign in to comment.