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 import models
7 from django.utils.translation import gettext_lazy as _
8 from django.conf import settings
11 class Subscription(models.Model):
12 email = models.EmailField(verbose_name=_('email address'), unique=True)
13 active = models.BooleanField(default=True, verbose_name=_('active'))
14 created_at = models.DateTimeField(auto_now_add=True)
15 last_modified = models.DateTimeField(auto_now=True)
18 verbose_name = _('subscription')
19 verbose_name_plural = _('subscriptions')
25 return hashlib.sha224(self.email + settings.SECRET_KEY).hexdigest()[:30]
28 class Newsletter(models.Model):
29 slug = models.SlugField(blank=True)
30 page_title = models.CharField(max_length=255, blank=True)
31 phplist_id = models.IntegerField(null=True, blank=True)
32 crm_id = models.IntegerField(null=True, blank=True)