Membership renewal when promotions module is disabled

This commit is contained in:
Yingtong Li 2022-03-01 19:10:17 +11:00
parent 98a163f63a
commit 5059c5f793
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
3 changed files with 73 additions and 67 deletions

View File

@ -2,7 +2,7 @@
{# {#
Society Self-Service Society Self-Service
Copyright © 2018-2020 Yingtong Li (RunasSudo) Copyright © 2018-2022 Yingtong Li (RunasSudo)
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by it under the terms of the GNU Affero General Public License as published by
@ -79,6 +79,7 @@
<option value="1">Yes, I am an MSA member</option> <option value="1">Yes, I am an MSA member</option>
</select> </select>
</div> </div>
{% if 'sspromotions' in settings.INSTALLED_APPS %}
<div class="ui divider"></div> <div class="ui divider"></div>
<h2>MUMUS Mail</h2> <h2>MUMUS Mail</h2>
@ -96,7 +97,7 @@
{% if group.subscribable %} {% if group.subscribable %}
<div class="field" style="display: inline; margin-right: 1em;"> <div class="field" style="display: inline; margin-right: 1em;">
<div class="ui checkbox"> <div class="ui checkbox">
<input type="checkbox" name="bulletin_group_{{ group.id }}" id="bulletin_group_{{ group.id }}"{% if group.contains_member(member) %} checked{% endif %}> <input type="checkbox" name="bulletin_group_{{ group.id }}" id="bulletin_group_{{ group.id }}" checked>
<label for="bulletin_group_{{ group.id }}">{{ group.name }}</label> <label for="bulletin_group_{{ group.id }}">{{ group.name }}</label>
</div> </div>
</div> </div>
@ -105,6 +106,7 @@
<p style="margin-top: 0.5em;">MUMUS Mail is personalised for you. Choose the groups that you would like to see first in each edition of MUMUS Mail.</p> <p style="margin-top: 0.5em;">MUMUS Mail is personalised for you. Choose the groups that you would like to see first in each edition of MUMUS Mail.</p>
</div> </div>
</div> </div>
{% endif %}
<div class="ui divider"></div> <div class="ui divider"></div>
<input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}"> <input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
<input type="hidden" name="email_orig" value="{{ email_orig }}"> <input type="hidden" name="email_orig" value="{{ email_orig }}">

View File

@ -2,7 +2,7 @@
{# {#
Society Self-Service Society Self-Service
Copyright © 2018-2019 Yingtong Li (RunasSudo) Copyright © 2018-2022 Yingtong Li (RunasSudo)
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by it under the terms of the GNU Affero General Public License as published by
@ -72,6 +72,7 @@
<option value="1">Yes, I am an MSA member</option> <option value="1">Yes, I am an MSA member</option>
</select> </select>
</div> </div>
{% if 'sspromotions' in settings.INSTALLED_APPS %}
<div class="ui divider"></div> <div class="ui divider"></div>
<h2>MUMUS Mail</h2> <h2>MUMUS Mail</h2>
@ -98,6 +99,7 @@
<p style="margin-top: 0.5em;">MUMUS Mail is personalised for you. Choose the groups that you would like to see first in each edition of MUMUS Mail.</p> <p style="margin-top: 0.5em;">MUMUS Mail is personalised for you. Choose the groups that you would like to see first in each edition of MUMUS Mail.</p>
</div> </div>
</div> </div>
{% endif %}
<div class="ui divider"></div> <div class="ui divider"></div>
<input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}"> <input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
<input class="ui primary button" type="submit" name='submit' value="Subscribe"> <input class="ui primary button" type="submit" name='submit' value="Subscribe">

View File

@ -1,5 +1,5 @@
# Society Self-Service # Society Self-Service
# Copyright © 2018-2020 Yingtong Li (RunasSudo) # Copyright © 2018-2022 Yingtong Li (RunasSudo)
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
@ -157,6 +157,7 @@ def renew_save(request):
member.save() member.save()
# Update bulletin # Update bulletin
if 'sspromotions' in settings.INSTALLED_APPS:
import sspromotions.models import sspromotions.models
sspromotions.models.BulletinSubscription.set_member_subscribed(member, True if request.POST['bulletin_subscribe'] == '1' else False) sspromotions.models.BulletinSubscription.set_member_subscribed(member, True if request.POST['bulletin_subscribe'] == '1' else False)
for group in sspromotions.models.Group.objects.filter(subscribable=True).all(): for group in sspromotions.models.Group.objects.filter(subscribable=True).all():
@ -209,6 +210,7 @@ def signup_save(request):
member.save() member.save()
# Update bulletin # Update bulletin
if 'sspromotions' in settings.INSTALLED_APPS:
import sspromotions.models import sspromotions.models
sspromotions.models.BulletinSubscription.set_member_subscribed(member, True if request.POST['bulletin_subscribe'] == '1' else False) sspromotions.models.BulletinSubscription.set_member_subscribed(member, True if request.POST['bulletin_subscribe'] == '1' else False)
for group in sspromotions.models.Group.objects.filter(subscribable=True).all(): for group in sspromotions.models.Group.objects.filter(subscribable=True).all():