feat: add links to response of GET /api/club/{club_id}

This commit is contained in:
imperosol
2026-05-02 19:31:03 +02:00
parent 59847b3973
commit b9b0c00b74
3 changed files with 9 additions and 3 deletions
+6
View File
@@ -2,6 +2,7 @@ from typing import Annotated
from django.db.models import Q
from ninja import FilterLookup, FilterSchema, ModelSchema
from pydantic import HttpUrl
from club.models import Club, ClubRole, Membership
from core.schemas import NonEmptyStr, SimpleUserSchema
@@ -62,6 +63,11 @@ class ClubSchema(ModelSchema):
fields = ["id", "name", "logo", "is_active", "short_description", "address"]
members: list[ClubMemberSchema]
links: list[HttpUrl]
@staticmethod
def resolve_links(obj: Club):
return [link.url for link in obj.links.all()]
class UserMembershipSchema(ModelSchema):