1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
6 from django.db.models import Model, EmailField, DateTimeField, BooleanField
7 from django.utils.translation import ugettext_lazy as _
8 from django.conf import settings
11 class Subscription(Model):
12 email = EmailField(verbose_name=_('email address'), unique=True)
13 active = BooleanField(default=True, verbose_name=_('active'))
14 created_at = DateTimeField(auto_now_add=True)
15 last_modified = DateTimeField(auto_now=True)
18 verbose_name = _('subscription')
19 verbose_name_plural = _('subscriptions')
25 return hashlib.sha224(self.email + settings.SECRET_KEY).hexdigest()[:30]