Customise mandatory bulletin groups

This commit is contained in:
Yingtong Li 2019-02-13 15:24:14 +11:00
parent 229b193b25
commit 4eec729dc2
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
3 changed files with 3 additions and 3 deletions

View File

@ -27,7 +27,7 @@ ALLOWED_HOSTS = []
PROMO_LOGO_URL = 'https://placehold.it/2000x500'
PROMO_LOGO_LINK = 'https://example.com'
PROMO_GROUPS_MANDATORY = ['All Years']
# Application definition

View File

@ -62,7 +62,7 @@
<h2 class="text-center">{{ group.name }}</h2>
{% if group.group.subscribable %}
<div class="group-options"><a href="https://{{ settings.ALLOWED_HOSTS[0] }}{{ url('membership') }}">Unsubscribe</a></div>
{% elif group.name != 'All Years' %}
{% elif group.name not in settings.PROMO_GROUPS_MANDATORY %}
<div class="group-options"><a href="https://{{ settings.ALLOWED_HOSTS[0] }}{{ url('membership') }}">Change year level</a></div>
{% endif %}
</th>

View File

@ -50,7 +50,7 @@ class Group(models.Model):
if self.subscribable:
return GroupSubscription.objects.filter(member=member, group=self).count() > 0
if self.name == 'All Years':
if self.name in settings.PROMO_GROUPS_MANDATORY:
return True
if next(v for k, v in Member.YEARS if k == member.year) in self.name.split('/'):
# Year level group