+ @classmethod
+ def reset(cls, email):
+ cls.objects.filter(email=email).delete()
+ Schedule = apps.get_model('club', 'Schedule')
+ Membership = apps.get_model('club', 'Membership')
+ for schedule in Schedule.objects.filter(email=email):
+ schedule.update_contact()
+ for membership in Membership.objects.filter(manual=True, user__email=email):
+ membership.update_contact()
+
+ def wl_optout_url(self):
+ return 'https://wolnelektury.pl' + self.get_optout_url()
+
+
+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'))
+
+ class Meta:
+ verbose_name = _('email sent')
+ verbose_name_plural = _('emails sent')
+ ordering = ('-timestamp',)
+
+ def __str__(self):
+ return '%s %s' % (self.contact.email, self.timestamp)
+