From 15a6162fe07f00e8eacad7ae25e5b9c31ac2fefb Mon Sep 17 00:00:00 2001 From: jungmir Date: Sun, 6 Oct 2024 01:15:57 +0900 Subject: [PATCH 1/3] =?UTF-8?q?Update:=20=EC=9E=85=EA=B8=88=EB=90=9C=20?= =?UTF-8?q?=ED=9B=84=EC=9B=90=EC=82=AC=EB=A7=8C=20=EB=B3=BC=20=EC=88=98=20?= =?UTF-8?q?=EC=9E=88=EB=8F=84=EB=A1=9D=20=ED=95=84=ED=84=B0=EB=A7=81=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sponsor/admin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sponsor/admin.py b/sponsor/admin.py index 4c0bddd..cf92fd9 100644 --- a/sponsor/admin.py +++ b/sponsor/admin.py @@ -20,8 +20,9 @@ class SponsorAdmin(SummernoteModelAdmin): "submitted", "accepted", "paid_at", + "year", ) - list_filter = ("accepted", "submitted") + list_filter = ("accepted", "submitted", "paid_at") ordering = ("-created_at",) From afb875ee66314f10ef2f19b09ccd7b977de916d8 Mon Sep 17 00:00:00 2001 From: jungmir Date: Sun, 6 Oct 2024 01:16:47 +0900 Subject: [PATCH 2/3] =?UTF-8?q?Fix:=20=EC=96=B4=EB=93=9C=EB=AF=BC=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=EC=97=90=EC=84=9C=20=EC=97=B0?= =?UTF-8?q?=EB=8F=84=EB=B3=84=EB=A1=9C=20=ED=9B=84=EC=9B=90=EC=82=AC=20?= =?UTF-8?q?=EB=93=B1=EA=B8=89=20=EC=9D=B4=EB=A6=84=EC=9D=B4=20=EA=B0=99?= =?UTF-8?q?=EC=9D=80=20=EA=B2=BD=EC=9A=B0=20=EA=B5=AC=EB=B6=84=20=ED=95=A0?= =?UTF-8?q?=20=EC=88=98=20=EC=9E=88=EB=8F=84=EB=A1=9D=20=EC=97=B0=EB=8F=84?= =?UTF-8?q?=20=EC=A0=95=EB=8F=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sponsor/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sponsor/models.py b/sponsor/models.py index 2cd4351..e87df7c 100644 --- a/sponsor/models.py +++ b/sponsor/models.py @@ -67,7 +67,7 @@ def accepted_count(self): return Sponsor.objects.filter(level=self, submitted=True, accepted=True).count() def __str__(self): - return self.name + return f"({self.year}) {self.name}" class BenefitByLevel(models.Model): From 6c82021efdd4aaaa6df954577cf123e5353f0354 Mon Sep 17 00:00:00 2001 From: jungmir Date: Sun, 6 Oct 2024 01:17:14 +0900 Subject: [PATCH 3/3] =?UTF-8?q?Fix:=20=ED=9B=84=EC=9B=90=EC=82=AC=20?= =?UTF-8?q?=EB=AA=A9=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20=EC=8B=9C=20=ED=95=84?= =?UTF-8?q?=EC=9A=94=20=EC=97=86=EB=8A=94=20=EB=93=B1=EA=B8=89=EB=B3=84=20?= =?UTF-8?q?=ED=98=9C=ED=83=9D=20=EC=A0=95=EB=B3=B4=EA=B0=80=20=ED=8F=AC?= =?UTF-8?q?=ED=95=A8=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sponsor/serializers.py | 14 +++++++++----- sponsor/viewsets.py | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/sponsor/serializers.py b/sponsor/serializers.py index d87b308..5a948dd 100644 --- a/sponsor/serializers.py +++ b/sponsor/serializers.py @@ -82,10 +82,6 @@ class Meta: class SponsorLevelSerializer(serializers.ModelSerializer): - benefits = SponsorBenefitWithOfferSerializer( - many=True, read_only=True, source="benefit_by_level" - ) - class Meta: model = SponsorLevel fields = [ @@ -96,11 +92,19 @@ class Meta: "price", "limit", "order", - "benefits", ] read_only_fields = ["id"] +class SponsorLevelWithBenefitSerializer(SponsorLevelSerializer): + benefits = SponsorBenefitWithOfferSerializer( + many=True, read_only=True, source="benefit_by_level" + ) + + class Meta(SponsorLevelSerializer.Meta): + fields = SponsorLevelSerializer.Meta.fields + ["benefits"] + + class SponsorSummariesSerializer(serializers.ModelSerializer): class Meta: model = Sponsor diff --git a/sponsor/viewsets.py b/sponsor/viewsets.py index 59d5f2a..faa5f30 100644 --- a/sponsor/viewsets.py +++ b/sponsor/viewsets.py @@ -16,11 +16,11 @@ PatronListSerializer, SponsorBenefitSerializer, SponsorDetailSerializer, - SponsorLevelSerializer, SponsorListSerializer, SponsorRemainingAccountSerializer, SponsorSerializer, SponsorWithLevelSerializer, + SponsorLevelWithBenefitSerializer, ) from sponsor.slack import send_new_sponsor_notification from sponsor.validators import SponsorValidater @@ -49,7 +49,7 @@ def get_serializer_class(self): case "list_with_levels": return SponsorWithLevelSerializer case _: - return SponsorLevelSerializer + return SponsorLevelWithBenefitSerializer @action(detail=False, methods=["GET"], url_path="with-sponsor") def list_with_levels(self, request, version):