mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-11-27 00:07:11 +00:00
48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
# Copyright (C) 2020 by Animath
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
from rest_framework import serializers
|
|
from rest_polymorphic.serializers import PolymorphicSerializer
|
|
|
|
from ..models import AdminRegistration, CoachRegistration, ParticipantRegistration, \
|
|
StudentRegistration, VolunteerRegistration
|
|
|
|
|
|
class AdminSerializer(serializers.ModelSerializer):
|
|
class Meta:
|
|
model = AdminRegistration
|
|
fields = '__all__'
|
|
|
|
|
|
class CoachSerializer(serializers.ModelSerializer):
|
|
class Meta:
|
|
model = CoachRegistration
|
|
fields = '__all__'
|
|
|
|
|
|
class ParticipantSerializer(serializers.ModelSerializer):
|
|
class Meta:
|
|
model = ParticipantRegistration
|
|
fields = '__all__'
|
|
|
|
|
|
class StudentSerializer(serializers.ModelSerializer):
|
|
class Meta:
|
|
model = StudentRegistration
|
|
fields = '__all__'
|
|
|
|
|
|
class VolunteerSerializer(serializers.ModelSerializer):
|
|
class Meta:
|
|
model = VolunteerRegistration
|
|
fields = '__all__'
|
|
|
|
|
|
class RegistrationSerializer(PolymorphicSerializer):
|
|
model_serializer_mapping = {
|
|
AdminRegistration: AdminSerializer,
|
|
CoachRegistration: CoachSerializer,
|
|
StudentRegistration: StudentSerializer,
|
|
VolunteerRegistration: VolunteerSerializer,
|
|
}
|