Files
PORTAL_COD2/general_vacation/views.py
T
2023-10-16 09:28:31 +03:00

34 lines
1.3 KiB
Python

from rest_framework.response import Response
import datetime
from .serializers import *
from .models import *
import pandas as pd
from rest_framework.views import APIView
from userauth.models import *
class GeneralVacationAPIView(APIView):
def get(self, request):
general = GeneralVacation.objects.all()
plan = PlanCalendar.objects.all()
# Сериализуем извлечённый набор записей
serializer_for_basecrit = GeneralVacationSerializer(
instance=general, # Передаём набор записей
many=True # Указываем, что на вход подаётся именно набор записей
)
serializer_for_plan = PlanCalendarSerializer(
instance=plan, # Передаём набор записей
many=True # Указываем, что на вход подаётся именно набор записей
)
return Response({"Отпуск": serializer_for_basecrit.data, "План-график": serializer_for_plan.data})
class DailyRoundUpAPIView(APIView):
def get(self, request):
user = DictEmployee.objects.using('user_directory').values('login', 'fio')
df = pd.DataFrame.from_records(user)
print(df)
return Response('user')