From 6bdd6a392fcff72b9f8b0ab1bff912abfb89d244 Mon Sep 17 00:00:00 2001 From: Michael Hall Date: Sun, 16 Dec 2018 22:39:40 -0500 Subject: [PATCH] Fix event admin filtering --- events/admin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/events/admin.py b/events/admin.py index 3b196a9..b9d5a73 100644 --- a/events/admin.py +++ b/events/admin.py @@ -55,11 +55,11 @@ class NumberOfEventsFilter(SimpleListFilter): if self.value() == '0': return queryset.annotate(num_events=Count('event')).filter(num_events=0) if self.value() == '>0': - return queryset.annotate(num_events=Count('event')).filter(num_events=1) + return queryset.annotate(num_events=Count('event')).filter(num_events__gte=0) if self.value() == '1': - return queryset.annotate(num_events=Count('event')).filter(num_events__gte=2, num_events__lte=9) + return queryset.annotate(num_events=Count('event')).filter(num_events=1) if self.value() == '2': - return queryset.annotate(num_events=Count('event')).filter(num_events__gte=1, num_events__lte=9) + return queryset.annotate(num_events=Count('event')).filter(num_events__gte=2, num_events__lte=9) if self.value() == '10': return queryset.annotate(num_events=Count('event')).filter(num_events__gte=10, num_events__lte=99) if self.value() == '100':