Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed some bugs

  • Loading branch information...
commit 5797d68a944ff7aeea78cd135b95c7df8ccc43d5 1 parent d143fcd
@brosner brosner authored
Showing with 10 additions and 2 deletions.
  1. +9 −1 mailout/email_lists.py
  2. +1 −1  mailout/models.py
View
10 mailout/email_lists.py
@@ -13,7 +13,7 @@ def _load(self):
self._lists = {}
for mp in settings.MAILOUT_MODULES:
i = mp.rfind(".")
- path, module = path[:i], path[i+1:]
+ path, module = mp[:i], mp[i+1:]
m = import_module(mp)
self._lists[module] = {
"list": m.email_list,
@@ -27,6 +27,14 @@ def __getitem__(self, key):
def keys(self):
self._load()
return self._lists.keys()
+
+ def choices(self):
+ self._load()
+ for k, v in self._lists.iteritems():
+ yield (k, k)
+# NOTE: while EmailListDict is lazy, mailout will force evaluation during
+# importing models.py which means weird side-effects can occur if user mailout
+# modules are setup poorly.
email_lists = EmailListDict()
View
2  mailout/models.py
@@ -35,7 +35,7 @@ class Campaign(models.Model):
from_address = models.CharField(max_length=150)
email_template = models.ForeignKey(EmailTemplate)
- email_list = models.CharField(max_length=50)
+ email_list = models.CharField(max_length=50, choices=email_lists.choices())
created = models.DateTimeField(default=datetime.datetime.now)
sent = models.DateTimeField(null=True)
Please sign in to comment.
Something went wrong with that request. Please try again.