X-Git-Url: https://git.ozlabs.org/?p=patchwork;a=blobdiff_plain;f=apps%2Fpatchwork%2Fmodels.py;h=f21d07322c544d3860a3128f65f76a7faa12b880;hp=ee6748fa44c835cc9110c7c4710f2f79c75f8dc2;hb=41f19b6643b44768dc06561c992c04ed6148477d;hpb=56e2243f3be7e859666ce0e4e1a8b8b94444f8d4 diff --git a/apps/patchwork/models.py b/apps/patchwork/models.py index ee6748f..f21d073 100644 --- a/apps/patchwork/models.py +++ b/apps/patchwork/models.py @@ -21,6 +21,7 @@ from django.db import models from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.contrib.sites.models import Site +from django.conf import settings from patchwork.parser import hash_patch import re @@ -374,9 +375,11 @@ class BundlePatch(models.Model): ordering = ['order'] class EmailConfirmation(models.Model): - validity = datetime.timedelta(days = 30) + validity = datetime.timedelta(days = settings.CONFIRMATION_VALIDITY_DAYS) type = models.CharField(max_length = 20, choices = [ ('userperson', 'User-Person association'), + ('registration', 'Registration'), + ('optout', 'Email opt-out'), ]) email = models.CharField(max_length = 200) user = models.ForeignKey(User, null = True) @@ -398,4 +401,8 @@ class EmailConfirmation(models.Model): self.key = self._meta.get_field('key').construct(str).hexdigest() super(EmailConfirmation, self).save() +class EmailOptout(models.Model): + email = models.CharField(max_length = 200, primary_key = True) + def __unicode__(self): + return self.email