mirror of
https://github.com/ae-utbm/sith.git
synced 2025-02-27 09:57:09 +00:00
24 lines
451 B
Python
24 lines
451 B
Python
from ninja import ModelSchema
|
|
|
|
from club.models import Club
|
|
|
|
|
|
class ClubSchema(ModelSchema):
|
|
class Meta:
|
|
model = Club
|
|
fields = ["id", "name"]
|
|
|
|
|
|
class ClubProfileSchema(ModelSchema):
|
|
"""The infos needed to display a simple club profile."""
|
|
|
|
class Meta:
|
|
model = Club
|
|
fields = ["id", "name", "logo"]
|
|
|
|
url: str
|
|
|
|
@staticmethod
|
|
def resolve_url(obj: Club) -> str:
|
|
return obj.get_absolute_url()
|