We planned to upgrade GitLab and Mattermost to the latest version this Friday morning. Expect some downtime!

Commit 62b07814 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg

Add benefactors tab to members

parent bf666595
This diff was suppressed by a .gitattributes entry.
......@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-25 20:13+0200\n"
"PO-Revision-Date: 2018-10-25 00:01+0200\n"
"POT-Creation-Date: 2018-10-31 00:27+0100\n"
"PO-Revision-Date: 2018-10-31 00:27+0100\n"
"Last-Translator: Thom Wiggers <thom@thomwiggers.nl>\n"
"Language-Team: \n"
"Language: nl\n"
......@@ -951,6 +951,10 @@ msgstr "Zoeken"
msgid "All members"
msgstr "Alle leden"
#: templates/members/index.html
msgid "Benefactors"
msgstr "Begunstigers"
#: templates/members/index.html
msgid "Honorary Members"
msgstr "Ere-leden"
......
......@@ -44,27 +44,35 @@
{% endfor %}
<li class="nav-item">
<a class="nav-link{% if filter == "old" %}active{% endif %}"
href="{% url 'members:index' %}?filter=old{% if keywords %}&keywords={{ keys }}{% endif %}{% if page %}&page={{ page }}{% endif %}#members-directory">
href="{% url 'members:index' %}?filter=older{% if keywords %}&keywords={{ keys }}{% endif %}{% if page %}&page={{ page }}{% endif %}#members-directory">
{% trans "Older" %}
</a>
</li>
<li class="nav-item">
<a class="nav-link{% if filter == "benefactors" %} active{% endif %}"
href="{% url 'members:index' %}?filter=benefactors{% if keywords %}&keywords={{ keys }}{% endif %}{% if page %}&page={{ page }}{% endif %}#members-directory">
{% trans "Benefactors" %}
</a>
</li>
<li class="nav-item">
<a class="nav-link{% if filter == "honor" %} active{% endif %}"
href="{% url 'members:index' %}?filter=honor{% if keywords %}&keywords={{ keys }}{% endif %}{% if page %}&page={{ page }}{% endif %}#members-directory">
href="{% url 'members:index' %}?filter=honorary{% if keywords %}&keywords={{ keys }}{% endif %}{% if page %}&page={{ page }}{% endif %}#members-directory">
{% trans "Honorary Members" %}
</a>
</li>
<li class="nav-item">
<a class="nav-link{% if filter == "ex" %} active{% endif %}"
href="{% url 'members:index' %}?filter=ex{% if keywords %}&keywords={{ keys }}{% endif %}{% if page %}&page={{ page }}{% endif %}#members-directory">
href="{% url 'members:index' %}?filter=former{% if keywords %}&keywords={{ keys }}{% endif %}{% if page %}&page={{ page }}{% endif %}#members-directory">
{% trans "Former Members" %}
</a>
</li>
</ul>
{% if not members %}
{% trans 'No members found' as info_text %}
{% alert 'info' info_text dismissable=True %}
<div class="mt-4">
{% trans 'No members found' as info_text %}
{% alert 'info' info_text dismissable=False %}
</div>
{% else %}
<div class="row mt-4">
{% for member in members %}
......
......@@ -43,17 +43,22 @@ def filter_users(tab, keywords, year_range):
if tab and tab.isdigit():
members_query &= Q(profile__starting_year=int(tab))
elif tab == 'old':
memberships_query &= Q(type=Membership.MEMBER)
elif tab == 'older':
members_query &= Q(profile__starting_year__lt=year_range[-1])
elif tab == 'ex':
memberships_query &= Q(type=Membership.MEMBER)
elif tab == 'former':
# Filter out all current active memberships
memberships_query &= Q(type='member') | Q(type='honorary')
memberships_query &= (Q(type=Membership.MEMBER) |
Q(type=Membership.HONORARY))
memberships = models.Membership.objects.filter(memberships_query)
members_query &= ~Q(pk__in=memberships.values('user__pk'))
# Members_query contains users that are not currently (honorary)member
elif tab == 'honor':
elif tab == 'benefactors':
memberships_query &= Q(type=Membership.BENEFACTOR)
elif tab == 'honorary':
memberships_query = Q(until__gt=datetime.now().date()) | Q(until=None)
memberships_query &= Q(type='honorary')
memberships_query &= Q(type=Membership.HONORARY)
if keywords:
for key in keywords:
......@@ -65,8 +70,9 @@ def filter_users(tab, keywords, year_range):
Q(last_name__icontains=key) |
Q(username__icontains=key))
if tab == 'ex':
memberships_query = Q(type='member') | Q(type='honorary')
if tab == 'former':
memberships_query = (Q(type=Membership.MEMBER) |
Q(type=Membership.HONORARY))
memberships = models.Membership.objects.filter(memberships_query)
all_memberships = models.Membership.objects.all()
# Only keep members that were once members, or are legacy users that
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment