X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/700710d1aa59af7316ba9694711bfca051925677..df60910b2d457f031cbe0a153e51e7378c0165d8:/src/messaging/models.py diff --git a/src/messaging/models.py b/src/messaging/models.py index d598fc852..7891e0c63 100644 --- a/src/messaging/models.py +++ b/src/messaging/models.py @@ -112,6 +112,7 @@ class Contact(models.Model): (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')), ]) since = models.DateTimeField() @@ -163,6 +164,16 @@ class Contact(models.Model): self.expires_at = expires_at self.save() + @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()