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
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)
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