From 3e0bdfe38382d6974a8fcd29e953e02f375a9cf8 Mon Sep 17 00:00:00 2001 From: jessiebelle Date: Sun, 7 Jan 2024 10:39:52 +0200 Subject: [PATCH] WIP --- sponsors/admin.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sponsors/admin.py b/sponsors/admin.py index 22326b55c..13dce2eb0 100644 --- a/sponsors/admin.py +++ b/sponsors/admin.py @@ -246,16 +246,15 @@ def has_delete_permission(self, request, obj=None): return True return obj.open_for_editing - def get_queryset(self, *args, **kwargs): + def get_queryset(self, request): + qs = super().get_queryset(request) match = request.resolver_match - sponsorship = self.parent_model.objects.get(pk=match.kwargs["object_id"]) + sponsorship = self.parent_model.objects.get(pk=match.kwargs["object_id"]) year = sponsorship.year - # available_packages = SponsorshipPackage.objects.from_year(year) - qs = super().get_queryset(*args, **kwargs) filtered = qs.filter(sponsorship_benefit__year=year) - return filtered.select_related("sponsorship_benefit__program", "program") + return filtered class TargetableEmailBenefitsFilter(admin.SimpleListFilter):