mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-23 00:01:16 +00:00
Actually make old subscribers members of the old subscribers groups.
This commit is contained in:
parent
a2a85717a0
commit
4f58535bdb
@ -357,8 +357,6 @@ class User(AbstractUser):
|
|||||||
return True
|
return True
|
||||||
if group.id == settings.SITH_GROUP_SUBSCRIBERS_ID:
|
if group.id == settings.SITH_GROUP_SUBSCRIBERS_ID:
|
||||||
return self.is_subscribed
|
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:
|
if group.id == settings.SITH_GROUP_ROOT_ID:
|
||||||
return self.is_root
|
return self.is_root
|
||||||
return group in self.cached_groups
|
return group in self.cached_groups
|
||||||
|
@ -76,8 +76,8 @@ class Subscription(models.Model):
|
|||||||
super().save()
|
super().save()
|
||||||
from counter.models import Customer
|
from counter.models import Customer
|
||||||
|
|
||||||
_, created = Customer.get_or_create(self.member)
|
_, account_created = Customer.get_or_create(self.member)
|
||||||
if created:
|
if account_created:
|
||||||
form = PasswordResetForm({"email": self.member.email})
|
form = PasswordResetForm({"email": self.member.email})
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
form.save(
|
form.save(
|
||||||
@ -86,6 +86,9 @@ class Subscription(models.Model):
|
|||||||
subject_template_name="core/new_user_email_subject.jinja",
|
subject_template_name="core/new_user_email_subject.jinja",
|
||||||
from_email="ae@utbm.fr",
|
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()
|
self.member.make_home()
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user