X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/08e687e53ba84afd39646185142e59c6bfe77783..2c101e78aee8cd3ccf3f24a0ecaa22fa77593c5c:/src/messaging/models.py diff --git a/src/messaging/models.py b/src/messaging/models.py index e1b26a8a0..b9cbcade5 100644 --- a/src/messaging/models.py +++ b/src/messaging/models.py @@ -6,34 +6,33 @@ from django.db import models from django.template import Template, Context from django.urls import reverse from django.utils.timezone import now, get_current_timezone -from django.utils.translation import gettext_lazy as _ from sentry_sdk import capture_exception from catalogue.utils import get_random_hash from .states import Level, states class EmailTemplate(models.Model): - state = models.CharField(_('state'), max_length=128, choices=[(s.slug, s.name) for s in states], help_text='?') - subject = models.CharField(_('subject'), max_length=1024) - body = models.TextField(_('body')) - min_days_since = models.SmallIntegerField(_('min days since'), null=True, blank=True) - max_days_since = models.SmallIntegerField(_('max days since'), null=True, blank=True) - min_hour = models.PositiveSmallIntegerField(_('min hour'), null=True, blank=True) - max_hour = models.PositiveSmallIntegerField(_('max hour'), null=True, blank=True) - min_day_of_month = models.PositiveSmallIntegerField(_('min day of month'), null=True, blank=True) - max_day_of_month = models.PositiveSmallIntegerField(_('max day of month'), null=True, blank=True) - dow_1 = models.BooleanField(_('Monday'), default=True) - dow_2 = models.BooleanField(_('Tuesday'), default=True) - dow_3 = models.BooleanField(_('Wednesday'), default=True) - dow_4 = models.BooleanField(_('Thursday'), default=True) - dow_5 = models.BooleanField(_('Friday'), default=True) - dow_6 = models.BooleanField(_('Saturday'), default=True) - dow_7 = models.BooleanField(_('Sunday'), default=True) - is_active = models.BooleanField(_('active'), default=False) + state = models.CharField('stan', max_length=128, choices=[(s.slug, s.name) for s in states], help_text='?') + subject = models.CharField('temat', max_length=1024) + body = models.TextField('treść') + min_days_since = models.SmallIntegerField('dni po, od', null=True, blank=True) + max_days_since = models.SmallIntegerField('dni po, do', null=True, blank=True) + min_hour = models.PositiveSmallIntegerField('od godziny', null=True, blank=True) + max_hour = models.PositiveSmallIntegerField('do godziny', null=True, blank=True) + min_day_of_month = models.PositiveSmallIntegerField('od dnia miesiąca', null=True, blank=True) + max_day_of_month = models.PositiveSmallIntegerField('do dnia miesiąca', null=True, blank=True) + dow_1 = models.BooleanField('poniedziałek', default=True) + dow_2 = models.BooleanField('wtorek', default=True) + dow_3 = models.BooleanField('środa', default=True) + dow_4 = models.BooleanField('czwartek', default=True) + dow_5 = models.BooleanField('piątek', default=True) + dow_6 = models.BooleanField('sobota', default=True) + dow_7 = models.BooleanField('niedziela', default=True) + is_active = models.BooleanField('aktywny', default=False) class Meta: - verbose_name = _('email template') - verbose_name_plural = _('email templates') + verbose_name = 'szablon e-maila' + verbose_name_plural = 'szablony e-maili' def __str__(self): return '%s (%+d)' % (self.get_state_display(), self.min_days_since or 0) @@ -108,20 +107,20 @@ class Contact(models.Model): email = models.EmailField(unique=True) level = models.PositiveSmallIntegerField( choices=[ - (Level.COLD, _('Cold')), - (Level.TRIED, _('Would-be donor')), - (Level.SINGLE, _('One-time donor')), - (Level.RECURRING, _('Recurring donor')), - (Level.MANUAL_MEMBER, _('Manually set as member')), - (Level.OPT_OUT, _('Opt out')), + (Level.COLD, 'Lodówka'), + (Level.TRIED, 'Niedoszły darczyńca'), + (Level.SINGLE, 'Darczyńca z jednorazową wpłatą'), + (Level.RECURRING, 'Darczyńca z wpłatą cykliczną'), + (Level.MANUAL_MEMBER, 'Członkostwo ustawione ręcznie'), + (Level.OPT_OUT, 'Opt out'), ]) since = models.DateTimeField() expires_at = models.DateTimeField(null=True, blank=True) key = models.CharField(max_length=64, blank=True) class Meta: - verbose_name = _('contact') - verbose_name_plural = _('contacts') + verbose_name = 'kontakt' + verbose_name_plural = 'kontakty' def save(self, *args, **kwargs): if not self.key: @@ -182,12 +181,12 @@ class EmailSent(models.Model): template = models.ForeignKey(EmailTemplate, models.CASCADE) contact = models.ForeignKey(Contact, models.CASCADE) timestamp = models.DateTimeField(auto_now_add=True) - subject = models.CharField(_('subject'), max_length=1024) - body = models.TextField(_('body')) + subject = models.CharField('temat', max_length=1024) + body = models.TextField('treść') class Meta: - verbose_name = _('email sent') - verbose_name_plural = _('emails sent') + verbose_name = 'wysłany e-mail' + verbose_name_plural = 'wysłane e-maile' ordering = ('-timestamp',) def __str__(self):