1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-26 18:22:23 +00:00
plateforme-tfjm2/participation/api/serializers.py

64 lines
1.7 KiB
Python
Raw Normal View History

2021-03-29 13:41:20 +00:00
# Copyright (C) 2020 by Animath
# SPDX-License-Identifier: GPL-3.0-or-later
from rest_framework import serializers
from ..models import Note, Participation, Passage, Pool, Solution, Synthesis, Team, Tournament
class NoteSerializer(serializers.ModelSerializer):
class Meta:
model = Note
fields = '__all__'
class ParticipationSerializer(serializers.ModelSerializer):
class Meta:
model = Participation
fields = '__all__'
class PassageSerializer(serializers.ModelSerializer):
class Meta:
model = Passage
fields = '__all__'
class PoolSerializer(serializers.ModelSerializer):
2021-04-04 10:17:54 +00:00
passages = serializers.ListSerializer(child=PassageSerializer(), read_only=True)
2021-03-29 14:06:09 +00:00
2021-03-29 13:41:20 +00:00
class Meta:
model = Pool
fields = '__all__'
class SolutionSerializer(serializers.ModelSerializer):
class Meta:
model = Solution
fields = '__all__'
class SynthesisSerializer(serializers.ModelSerializer):
class Meta:
model = Synthesis
fields = '__all__'
class TeamSerializer(serializers.ModelSerializer):
2021-03-29 14:06:09 +00:00
participation = ParticipationSerializer()
2021-03-29 13:41:20 +00:00
class Meta:
model = Team
fields = '__all__'
class TournamentSerializer(serializers.ModelSerializer):
2021-04-04 09:35:00 +00:00
participations = serializers.ListSerializer(child=ParticipationSerializer())
2021-03-29 13:41:20 +00:00
class Meta:
model = Tournament
2021-05-11 15:19:28 +00:00
fields = ('id', 'pk', 'name', 'date_start', 'date_end', 'place', 'max_teams', 'price', 'remote',
2021-03-29 14:06:09 +00:00
'inscription_limit', 'solution_limit', 'solutions_draw', 'syntheses_first_phase_limit',
'solutions_available_second_phase', 'syntheses_second_phase_limit',
'description', 'organizers', 'final', 'participations',)