1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-27 06:22:23 +00:00
plateforme-tfjm2/registration/api/serializers.py
Emmy D'Anello 1dd9a5cf94
Add autocomplete feature for jury form
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
2024-03-23 23:04:22 +01:00

54 lines
1.4 KiB
Python

# Copyright (C) 2020 by Animath
# SPDX-License-Identifier: GPL-3.0-or-later
from django.contrib.auth.models import User
from rest_framework import serializers
from rest_polymorphic.serializers import PolymorphicSerializer
from ..models import CoachRegistration, ParticipantRegistration, \
Payment, StudentRegistration, VolunteerRegistration
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 = {
CoachRegistration: CoachSerializer,
StudentRegistration: StudentSerializer,
VolunteerRegistration: VolunteerSerializer,
}
class PaymentSerializer(serializers.ModelSerializer):
class Meta:
model = Payment
fields = '__all__'
class BasicUserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ['id', 'first_name', 'last_name', 'email', ]