Commit c5aeb8da authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg Committed by Luko van der Maas
Browse files

Add filter to get all users without an active membership

parent 7aec1a31
...@@ -36,15 +36,21 @@ class ProfileInline(admin.StackedInline): ...@@ -36,15 +36,21 @@ class ProfileInline(admin.StackedInline):
class MembershipTypeListFilter(admin.SimpleListFilter): class MembershipTypeListFilter(admin.SimpleListFilter):
title = _('membership type') title = _('current membership type')
parameter_name = 'membership' parameter_name = 'membership'
def lookups(self, request, model_admin): def lookups(self, request, model_admin):
return models.Membership.MEMBERSHIP_TYPES return models.Membership.MEMBERSHIP_TYPES + (('none', _('None')),)
def queryset(self, request, queryset): def queryset(self, request, queryset):
if not self.value(): if not self.value():
return queryset 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 return (queryset
.exclude(membership=None) .exclude(membership=None)
......
...@@ -7,8 +7,8 @@ msgid "" ...@@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-31 19:21+0100\n" "POT-Creation-Date: 2018-11-12 19:36+0100\n"
"PO-Revision-Date: 2018-10-31 19:20+0100\n" "PO-Revision-Date: 2018-11-12 19:37+0100\n"
"Last-Translator: Thom Wiggers <thom@thomwiggers.nl>\n" "Last-Translator: Thom Wiggers <thom@thomwiggers.nl>\n"
"Language-Team: \n" "Language-Team: \n"
"Language: nl\n" "Language: nl\n"
...@@ -19,8 +19,12 @@ msgstr "" ...@@ -19,8 +19,12 @@ msgstr ""
"X-Generator: Poedit 2.2\n" "X-Generator: Poedit 2.2\n"
#: admin.py #: admin.py
msgid "membership type" msgid "current membership type"
msgstr "lidtype" msgstr "huidig lidtype"
#: admin.py
msgid "None"
msgstr "Geen"
#: admin.py #: admin.py
msgid "Age" 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