Skip to content

Commit

Permalink
style change quotation marks filters.py
Browse files Browse the repository at this point in the history
matched the style of the existing code, using " instead of '
  • Loading branch information
Sandplum authored Feb 24, 2025
1 parent 60dbcf7 commit 41700c0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions users/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@


class ServiceSubscriptionCountFilter(admin.SimpleListFilter):
title = 'Service Subscription Count'
parameter_name = 'service_subscription_count'
title = _("Service Subscription Count")
parameter_name = "service_subscription_count"

def lookups(self, request, model_admin):
# Defines filter options in the dropdown
return (
('0', '0 Subscriptions'),
('1', '1 Subscription'),
('2', '2 Subscriptions'),
('more_than_2', 'More than 2 Subscriptions'),
("0", _("0 Subscriptions")),
("1", _("1 Subscription")),
("2", _("2 Subscriptions")),
("more_than_2", _("More than 2 Subscriptions")),
)

def queryset(self, request, queryset):
# Filters the queryset based on the selected option
if self.value() == '0':
if self.value() == "0":
return queryset.annotate(num_subscriptions=Count('servicesubscription')).filter(num_subscriptions=0)
elif self.value() == '1':
elif self.value() == "1":
return queryset.annotate(num_subscriptions=Count('servicesubscription')).filter(num_subscriptions=1)
elif self.value() == '2':
elif self.value() == "2":
return queryset.annotate(num_subscriptions=Count('servicesubscription')).filter(num_subscriptions=2)
elif self.value() == 'more_than_2':
elif self.value() == "more_than_2":
return queryset.annotate(num_subscriptions=Count('servicesubscription')).filter(num_subscriptions__gt=2)
return queryset

Expand Down

0 comments on commit 41700c0

Please sign in to comment.