From 7bbeecb5dd5c5f20120f9e40e41568a3bff1caa4 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 26 Nov 2024 14:43:39 +0100 Subject: [PATCH] add a filter --- src/club/admin.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/club/admin.py b/src/club/admin.py index 8e4380eab..fc715e2cd 100644 --- a/src/club/admin.py +++ b/src/club/admin.py @@ -67,6 +67,12 @@ class ExpiredFilter(YesNoFilter): q = Q(expires_at__isnull=False, expires_at__lt=Now()) +class ActiveFilter(YesNoFilter): + title = 'płatność aktualna' + parameter_name = 'active' + q = Q(expires_at__gt=Now()) + + class ScheduleForm(forms.ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -111,7 +117,7 @@ class ScheduleAdmin(admin.ModelAdmin): search_fields = ['email', 'source'] list_filter = [ 'is_cancelled', 'monthly', 'yearly', 'method', - PayedFilter, ExpiredFilter, + PayedFilter, ActiveFilter, ExpiredFilter, SourceFilter, ] filter_horizontal = ['consent'] -- 2.20.1