Commit 6c715a94 authored by Luko van der Maas's avatar Luko van der Maas
Browse files

Merge branch 'feature/old-member-filter' into 'master'

Add filter to get all users without an active membership

Closes #767

See merge request !1053
parents 7aec1a31 7d573204
......@@ -36,15 +36,21 @@ class ProfileInline(admin.StackedInline):
class MembershipTypeListFilter(admin.SimpleListFilter):
title = _('membership type')
title = _('current membership type')
parameter_name = 'membership'
def lookups(self, request, model_admin):
return models.Membership.MEMBERSHIP_TYPES
return models.Membership.MEMBERSHIP_TYPES + (('none', _('None')),)
def queryset(self, request, queryset):
if not self.value():
return queryset
if self.value() == 'none':
return queryset.exclude(
~Q(membership=None) & (
Q(membership__until__isnull=True) |
Q(membership__until__gt=timezone.now().date())
))
return (queryset
.exclude(membership=None)
......@@ -89,12 +95,11 @@ class UserAdmin(BaseUserAdmin):
actions = ['address_csv_export', 'student_number_csv_export']
inlines = (ProfileInline, MembershipInline,)
# FIXME include proper filter for expiration
# https://docs.djangoproject.com/en/1.9/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter
list_filter = (MembershipTypeListFilter,
'is_superuser',
AgeListFilter,
'profile__event_permissions',)
'profile__event_permissions',
'profile__starting_year')
add_fieldsets = (
(None, {
......
......@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-31 19:21+0100\n"
"PO-Revision-Date: 2018-10-31 19:20+0100\n"
"POT-Creation-Date: 2018-11-12 19:36+0100\n"
"PO-Revision-Date: 2018-11-12 19:37+0100\n"
"Last-Translator: Thom Wiggers <thom@thomwiggers.nl>\n"
"Language-Team: \n"
"Language: nl\n"
......@@ -19,8 +19,12 @@ msgstr ""
"X-Generator: Poedit 2.2\n"
#: admin.py
msgid "membership type"
msgstr "lidtype"
msgid "current membership type"
msgstr "huidig lidtype"
#: admin.py
msgid "None"
msgstr "Geen"
#: admin.py
msgid "Age"
......
Supports Markdown
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