diff --git a/sponsors/api.py b/sponsors/api.py index 0d180be6d..c5a8173ab 100644 --- a/sponsors/api.py +++ b/sponsors/api.py @@ -29,6 +29,8 @@ def get(self, request, *args, **kwargs): logo_filters.is_valid(raise_exception=True) sponsorships = Sponsorship.objects.enabled().with_logo_placement() + if logo_filters.by_year: + sponsorships = sponsorships.filter(year=logo_filters.by_year) for sponsorship in sponsorships.select_related("sponsor").iterator(): sponsor = sponsorship.sponsor base_data = { diff --git a/sponsors/management/commands/create_pycon_vouchers_for_sponsors.py b/sponsors/management/commands/create_pycon_vouchers_for_sponsors.py index 3e3b4973d..67f624b0a 100644 --- a/sponsors/management/commands/create_pycon_vouchers_for_sponsors.py +++ b/sponsors/management/commands/create_pycon_vouchers_for_sponsors.py @@ -20,24 +20,24 @@ ) BENEFITS = { - 183: { - "internal_name": "full_conference_passes_code_2024", + 241: { + "internal_name": "full_conference_passes_code_2025", "voucher_type": "SPNS_COMP_", }, - 201: { - "internal_name": "expo_hall_only_passes_code_2024", + 259: { + "internal_name": "pycon_expo_hall_only_passes_code_2025", "voucher_type": "SPNS_EXPO_COMP_", }, - 208: { - "internal_name": "additional_full_conference_passes_code_2024", + 265: { + "internal_name": "pycon_additional_full_conference_passes_code_2025", "voucher_type": "SPNS_ADDL_DISC_REG_", }, - 225: { - "internal_name": "online_only_conference_passes_2024", - "voucher_type": "SPNS_ONLINE_COMP_", - }, - 237: { - "internal_name": "additional_expo_hall_only_passes_2024", + #225: { + # "internal_name": "online_only_conference_passes_2025", + # "voucher_type": "SPNS_ONLINE_COMP_", + #}, + 292: { + "internal_name": "pycon_additional_expo_hall_only_passes_2025", "voucher_type": "SPNS_EXPO_DISC_", }, } diff --git a/sponsors/serializers.py b/sponsors/serializers.py index c0782c12a..e47e28f0b 100644 --- a/sponsors/serializers.py +++ b/sponsors/serializers.py @@ -58,6 +58,7 @@ class FilterLogoPlacementsSerializer(serializers.Serializer): choices=[(c.value, c.name.replace("_", " ").title()) for c in LogoPlacementChoices], required=False, ) + year = serializers.IntegerField(required=False) @property def by_publisher(self): @@ -67,6 +68,10 @@ def by_publisher(self): def by_flight(self): return self.validated_data.get("flight") + @property + def by_year(self): + return self.validated_data.get("year") + def skip_logo(self, logo): if self.by_publisher and self.by_publisher != logo.publisher: return True