3fefc550fe
- Django backend with DRF (clubs, wrestlers, trainers, exercises, templates, trainings, homework, locations, leistungstest) - Next.js 16 frontend with React, Shadcn UI, Tailwind - JWT authentication - Full CRUD for all entities - Calendar view for trainings - Homework management system - Leistungstest tracking
15 lines
403 B
Python
15 lines
403 B
Python
from rest_framework import serializers
|
|
from .models import Club
|
|
|
|
|
|
class ClubSerializer(serializers.ModelSerializer):
|
|
wrestler_count = serializers.SerializerMethodField()
|
|
|
|
class Meta:
|
|
model = Club
|
|
fields = '__all__'
|
|
read_only_fields = ['created_at', 'updated_at']
|
|
|
|
def get_wrestler_count(self, obj):
|
|
return obj.wrestlers.filter(is_active=True).count()
|