mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 23:43:22 +00:00
feat: Nommage des templates / Intégration dans formulaire d'inscription
parent [#22]
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
from .register_form_views import RegisterFormView, RegisterFormWithIdView, send, resend, archive
|
||||
from .register_form_views import RegisterFormView, RegisterFormWithIdView, send, resend, archive, get_templates_by_rf
|
||||
from .registration_file_views import RegistrationTemplateMasterView, RegistrationTemplateMasterSimpleView, RegistrationTemplateView, RegistrationTemplateSimpleView
|
||||
from .registration_file_group_views import RegistrationFileGroupView, RegistrationFileGroupSimpleView, get_registration_files_by_group
|
||||
from .student_views import StudentView, StudentListView, ChildrenListView
|
||||
@ -17,6 +17,7 @@ __all__ = [
|
||||
'RegistrationFileGroupView',
|
||||
'RegistrationFileGroupSimpleView',
|
||||
'get_registration_files_by_group',
|
||||
'get_templates_by_rf',
|
||||
'StudentView',
|
||||
'StudentListView',
|
||||
'ChildrenListView',
|
||||
|
||||
@ -383,3 +383,23 @@ def resend(request,id):
|
||||
return JsonResponse({"message": f"Le dossier a été renvoyé à l'adresse {email}"}, safe=False)
|
||||
return JsonResponse({"errorMessage":errorMessage}, safe=False, status=status.HTTP_400_BAD_REQUEST)
|
||||
return JsonResponse({"errorMessage":'Dossier d\'inscription non trouvé'}, safe=False, status=status.HTTP_404_NOT_FOUND)
|
||||
|
||||
@swagger_auto_schema(
|
||||
method='get',
|
||||
responses={200: openapi.Response('Success', schema=openapi.Schema(
|
||||
type=openapi.TYPE_OBJECT,
|
||||
properties={
|
||||
'message': openapi.Schema(type=openapi.TYPE_STRING)
|
||||
}
|
||||
))},
|
||||
operation_description="Récupère les fichiers à signer d'un dossier d'inscription donné",
|
||||
operation_summary="Récupérer les fichiers à signer d'un dossier d'inscription donné"
|
||||
)
|
||||
@api_view(['GET'])
|
||||
def get_templates_by_rf(request, id):
|
||||
try:
|
||||
templates = RegistrationTemplate.objects.filter(registration_form=id)
|
||||
templates_data = list(templates.values())
|
||||
return JsonResponse(templates_data, safe=False)
|
||||
except RegistrationFileGroup.DoesNotExist:
|
||||
return JsonResponse({'error': 'Le groupe de fichiers n\'a pas été trouvé'}, status=404)
|
||||
@ -118,8 +118,8 @@ class RegistrationFileGroupSimpleView(APIView):
|
||||
def get_registration_files_by_group(request, id):
|
||||
try:
|
||||
group = RegistrationFileGroup.objects.get(id=id)
|
||||
templates = RegistrationTemplateMaster.objects.filter(groups=group)
|
||||
templates_data = list(templates.values())
|
||||
templateMasters = RegistrationTemplateMaster.objects.filter(groups=group)
|
||||
templates_data = list(templateMasters.values())
|
||||
return JsonResponse(templates_data, safe=False)
|
||||
except RegistrationFileGroup.DoesNotExist:
|
||||
return JsonResponse({'error': 'Le groupe de fichiers n\'a pas été trouvé'}, status=404)
|
||||
Reference in New Issue
Block a user