feat [P-281]: переделана шапка, список отделов получен и отрисован в селекте

This commit is contained in:
lexxik753 committed 2025-07-14 13:47:15 +03:00
1 parent cbd21e1985
commit a70267d4a2
5 files changed
+118 -29

No files matched your search

+1
View File
@@ -70,4 +70,5 @@ urlpatterns = [
path('api/safety/', include('safety.urls')),
path('api/tests/', include('tests.urls')),
path('api/vote/', include('vote.urls')),
path('api/userauth/', include('userauth.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+7
View File
@@ -135,3 +135,10 @@ class InfoUserCardSerializer(serializers.ModelSerializer):
class Meta:
model = DictEmployee
fields = ['department', 'fio', 'post', 'email', 'tel', 'room', 'login', 'familyname', 'name', 'parentname', 'id']
class DepartmentsSerializer(serializers.ModelSerializer):
class Meta:
model = DictDepartment
fields = '__all__'
+6
View File
@@ -0,0 +1,6 @@
from django.urls import path
from .views import *
urlpatterns = [
path('getdepartments', GetDepartment.as_view(), name= "GetDepartment")
]
+14 -1
View File
@@ -1,3 +1,16 @@
from django.shortcuts import render
from .models import DictDepartment
from .serializers import DepartmentsSerializer
from rest_framework.permissions import AllowAny, IsAuthenticated
from rest_framework.views import APIView
from rest_framework.response import Response
# Create your views here.
class GetDepartment(APIView):
permission_classes = (AllowAny,)
"""
Получаем отделы
"""
def get(self,request):
department = DictDepartment.objects.all()
return Response(DepartmentsSerializer(department, many=True).data)