Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

어드민 페이지에서 후원사 정보가 보기 편하도록 수정 #175

Merged
merged 4 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sponsor/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",)


Expand Down
2 changes: 1 addition & 1 deletion sponsor/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
14 changes: 9 additions & 5 deletions sponsor/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions sponsor/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
Loading