summaryrefslogtreecommitdiffstats
path: root/apps/patchwork/models.py
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2011-04-14 19:37:55 +0800
committerJeremy Kerr <jk@ozlabs.org>2011-04-14 19:37:55 +0800
commitf1e5f6a2c9d737f12290f5bd5a934b74c362616f (patch)
tree5917844b4f15870e9a0015f2ebd1d928190bf9cb /apps/patchwork/models.py
parent017f73b059aadfce30ee29d2aceeab92739105a6 (diff)
downloadpatchwork-f1e5f6a2c9d737f12290f5bd5a934b74c362616f.tar.bz2
patchwork-f1e5f6a2c9d737f12290f5bd5a934b74c362616f.tar.xz
notifications: implement opt-outnotifications
Check for opt-out status before sending notification mail. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'apps/patchwork/models.py')
-rw-r--r--apps/patchwork/models.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/apps/patchwork/models.py b/apps/patchwork/models.py
index 17a68db..22062c2 100644
--- a/apps/patchwork/models.py
+++ b/apps/patchwork/models.py
@@ -408,6 +408,11 @@ class EmailOptout(models.Model):
def __unicode__(self):
return self.email
+ @classmethod
+ def is_optout(cls, email):
+ email = email.lower().strip()
+ return cls.objects.filter(email = email).count() > 0
+
class PatchChangeNotification(models.Model):
patch = models.ForeignKey(Patch, primary_key = True)
last_modified = models.DateTimeField(default = datetime.datetime.now)