From fad5f2b7e4d5e2f08fc7d2e11c2c380bdc60efe0 Mon Sep 17 00:00:00 2001 From: Ee Durbin Date: Thu, 14 Dec 2023 14:46:07 -0500 Subject: [PATCH] filtering by current_year where necessary --- sponsors/admin.py | 2 +- sponsors/forms.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sponsors/admin.py b/sponsors/admin.py index aa3d5408e..ac05a00b8 100644 --- a/sponsors/admin.py +++ b/sponsors/admin.py @@ -258,7 +258,7 @@ class TargetableEmailBenefitsFilter(admin.SimpleListFilter): @cached_property def benefits(self): qs = EmailTargetableConfiguration.objects.all().values_list("benefit_id", flat=True) - benefits = SponsorshipBenefit.objects.filter(id__in=Subquery(qs)) + benefits = SponsorshipBenefit.objects.filter(id__in=Subquery(qs), year=SponsorshipCurrentYear.get_year()) return {str(b.id): b for b in benefits} def lookups(self, request, model_admin): diff --git a/sponsors/forms.py b/sponsors/forms.py index 01d3de4f2..f4c72726a 100644 --- a/sponsors/forms.py +++ b/sponsors/forms.py @@ -127,6 +127,7 @@ def get_package(self): if not pkg_benefits and standalone: # standalone only pkg, _ = SponsorshipPackage.objects.get_or_create( slug="standalone-only", + year=SponsorshipCurrentYear.get_year(), defaults={"name": "Standalone Only", "sponsorship_amount": 0}, )