mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 10:22:11 +01:00 
			
		
		
		
	Compare commits
	
		
			5 Commits
		
	
	
		
			1df1766753
			...
			d093414ec7
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						d093414ec7
	
				 | 
					
					
						|||
| 
						
						
							
						
						cba4a01117
	
				 | 
					
					
						|||
| 
						
						
							
						
						fde2fdba63
	
				 | 
					
					
						|||
| 
						
						
							
						
						aff1bbda0b
	
				 | 
					
					
						|||
| 
						
						
							
						
						4f9dfadb71
	
				 | 
					
					
						
@@ -3,7 +3,7 @@ FROM python:3.9-alpine
 | 
			
		||||
ENV PYTHONUNBUFFERED 1
 | 
			
		||||
ENV DJANGO_ALLOW_ASYNC_UNSAFE 1
 | 
			
		||||
 | 
			
		||||
RUN apk add --no-cache gettext nginx gcc libc-dev libffi-dev libxml2-dev libxslt-dev postgresql-dev libmagic texlive
 | 
			
		||||
RUN apk add --no-cache gettext nginx gcc git libc-dev libffi-dev libxml2-dev libxslt-dev postgresql-dev libmagic texlive
 | 
			
		||||
 | 
			
		||||
RUN apk add --no-cache bash
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -20,6 +20,10 @@ if "participation" in settings.INSTALLED_APPS:
 | 
			
		||||
    from participation.api.urls import register_participation_urls
 | 
			
		||||
    register_participation_urls(router, "participation")
 | 
			
		||||
 | 
			
		||||
if "registration" in settings.INSTALLED_APPS:
 | 
			
		||||
    from registration.api.urls import register_registration_urls
 | 
			
		||||
    register_registration_urls(router, "registration")
 | 
			
		||||
 | 
			
		||||
app_name = 'api'
 | 
			
		||||
 | 
			
		||||
# Wire up our API using automatic URL routing.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								apps/registration/api/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								apps/registration/api/__init__.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
 | 
			
		||||
# SPDX-License-Identifier: GPL-3.0-or-later
 | 
			
		||||
							
								
								
									
										47
									
								
								apps/registration/api/serializers.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								apps/registration/api/serializers.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
# 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,
 | 
			
		||||
    }
 | 
			
		||||
							
								
								
									
										11
									
								
								apps/registration/api/urls.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								apps/registration/api/urls.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
# Copyright (C) 2020 by Animath
 | 
			
		||||
# SPDX-License-Identifier: GPL-3.0-or-later
 | 
			
		||||
 | 
			
		||||
from .views import RegistrationViewSet
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def register_registration_urls(router, path):
 | 
			
		||||
    """
 | 
			
		||||
    Configure router for registration REST API.
 | 
			
		||||
    """
 | 
			
		||||
    router.register(path + "/registration", RegistrationViewSet)
 | 
			
		||||
							
								
								
									
										15
									
								
								apps/registration/api/views.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								apps/registration/api/views.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
# Copyright (C) 2020 by Animath
 | 
			
		||||
# SPDX-License-Identifier: GPL-3.0-or-later
 | 
			
		||||
 | 
			
		||||
from django_filters.rest_framework import DjangoFilterBackend
 | 
			
		||||
from rest_framework.viewsets import ModelViewSet
 | 
			
		||||
 | 
			
		||||
from .serializers import RegistrationSerializer
 | 
			
		||||
from ..models import Registration
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class RegistrationViewSet(ModelViewSet):
 | 
			
		||||
    queryset = Registration.objects.all()
 | 
			
		||||
    serializer_class = RegistrationSerializer
 | 
			
		||||
    filter_backends = [DjangoFilterBackend]
 | 
			
		||||
    filterset_fields = ['user', 'participantregistration__team', ]
 | 
			
		||||
@@ -1,8 +1,7 @@
 | 
			
		||||
asgiref~=3.3.1
 | 
			
		||||
Django~=3.1
 | 
			
		||||
django-address~=0.2
 | 
			
		||||
django-bootstrap-datepicker-plus~=3.0
 | 
			
		||||
django-cas-server~=1.2
 | 
			
		||||
git+https://gitlab.crans.org/ynerant/django-cas-server.git
 | 
			
		||||
django-crispy-forms~=1.9
 | 
			
		||||
django-extensions~=3.0
 | 
			
		||||
django-filter~=2.3
 | 
			
		||||
@@ -19,7 +18,7 @@ phonenumbers~=8.9.10
 | 
			
		||||
psycopg2-binary~=2.8
 | 
			
		||||
PyPDF3~=1.0.2
 | 
			
		||||
ipython~=7.19.0
 | 
			
		||||
python-magic>=0.4.21
 | 
			
		||||
python-magic>=0.4.22
 | 
			
		||||
requests~=2.25.0
 | 
			
		||||
sympasoap~=1.0
 | 
			
		||||
whoosh~=2.7
 | 
			
		||||
		Reference in New Issue
	
	Block a user