From 4f58535bdbff3ecf67110e5e8e85fe30865b4a05 Mon Sep 17 00:00:00 2001 From: imperosol Date: Tue, 3 Dec 2024 17:55:21 +0100 Subject: [PATCH] Actually make old subscribers members of the old subscribers groups. --- core/models.py | 2 -- subscription/models.py | 7 +++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/models.py b/core/models.py index 4e93b73c..e658f81b 100644 --- a/core/models.py +++ b/core/models.py @@ -357,8 +357,6 @@ class User(AbstractUser): return True if group.id == settings.SITH_GROUP_SUBSCRIBERS_ID: return self.is_subscribed - if group.id == settings.SITH_GROUP_OLD_SUBSCRIBERS_ID: - return self.was_subscribed if group.id == settings.SITH_GROUP_ROOT_ID: return self.is_root return group in self.cached_groups diff --git a/subscription/models.py b/subscription/models.py index 96d77d08..139b8ccb 100644 --- a/subscription/models.py +++ b/subscription/models.py @@ -76,8 +76,8 @@ class Subscription(models.Model): super().save() from counter.models import Customer - _, created = Customer.get_or_create(self.member) - if created: + _, account_created = Customer.get_or_create(self.member) + if account_created: form = PasswordResetForm({"email": self.member.email}) if form.is_valid(): form.save( @@ -86,6 +86,9 @@ class Subscription(models.Model): subject_template_name="core/new_user_email_subject.jinja", from_email="ae@utbm.fr", ) + # Someone who subscribed once will be considered forever + # as an old subscriber. + self.member.groups.add(settings.SITH_GROUP_OLD_SUBSCRIBERS_ID) self.member.make_home() def get_absolute_url(self):