mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
from django.http.response import JsonResponse
|
|
from rest_framework.views import APIView
|
|
from drf_yasg.utils import swagger_auto_schema
|
|
from drf_yasg import openapi
|
|
|
|
from Subscriptions.models import Guardian
|
|
from N3wtSchool import bdd
|
|
|
|
class GuardianView(APIView):
|
|
"""
|
|
Gestion des responsables légaux.
|
|
"""
|
|
|
|
@swagger_auto_schema(
|
|
operation_description="Récupère le dernier ID de responsable légal créé",
|
|
operation_summary="Récupèrer le dernier ID de responsable légal créé",
|
|
responses={
|
|
200: openapi.Response(
|
|
description="Dernier ID du responsable légal",
|
|
schema=openapi.Schema(
|
|
type=openapi.TYPE_OBJECT,
|
|
properties={
|
|
'lastid': openapi.Schema(
|
|
type=openapi.TYPE_INTEGER,
|
|
description="Dernier ID créé"
|
|
)
|
|
}
|
|
)
|
|
)
|
|
}
|
|
)
|
|
def get(self, request):
|
|
lastGuardian = bdd.getLastId(Guardian)
|
|
return JsonResponse({"lastid":lastGuardian}, safe=False)
|