Вывод назначенных готов
This commit is contained in:
1 parent
1f7bddff4f
commit
c99172bbdc
10 files changed
+91
-8
No files matched your search
Generated
+8
@@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
Generated
+27
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="django" name="Django">
|
||||||
|
<configuration>
|
||||||
|
<option name="rootFolder" value="$MODULE_DIR$/src/back" />
|
||||||
|
<option name="settingsModule" value="settings.py" />
|
||||||
|
<option name="manageScript" value="$MODULE_DIR$/src/back/manage.py" />
|
||||||
|
<option name="environment" value="<map/>" />
|
||||||
|
<option name="doNotUseTestRunner" value="false" />
|
||||||
|
<option name="trackFilePattern" value="migrations" />
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/back" isTestSource="false" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/env" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
<component name="PyDocumentationSettings">
|
||||||
|
<option name="format" value="PLAIN" />
|
||||||
|
<option name="myDocStringFormat" value="Plain" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
||||||
Generated
+7
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Black">
|
||||||
|
<option name="sdkName" value="Python 3.10 (PORTAL_COD2)" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (PORTAL_COD2)" project-jdk-type="Python SDK" />
|
||||||
|
</project>
|
||||||
Generated
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/PORTAL_COD2.iml" filepath="$PROJECT_DIR$/.idea/PORTAL_COD2.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -54,7 +54,7 @@ class Answer(models.Model):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Модель нахначения тестов
|
# Модель назначения тестов
|
||||||
class AppointmentTest(models.Model):
|
class AppointmentTest(models.Model):
|
||||||
dedline_date = models.DateField(blank=True, null=True, verbose_name="Дата окончания тестирования" )
|
dedline_date = models.DateField(blank=True, null=True, verbose_name="Дата окончания тестирования" )
|
||||||
tests = models.ForeignKey(Test, on_delete=models.PROTECT, blank=False, verbose_name="Тест")
|
tests = models.ForeignKey(Test, on_delete=models.PROTECT, blank=False, verbose_name="Тест")
|
||||||
@@ -63,7 +63,7 @@ class AppointmentTest(models.Model):
|
|||||||
verbose_name = "Назначение теста"
|
verbose_name = "Назначение теста"
|
||||||
verbose_name_plural = "Назначение теста"
|
verbose_name_plural = "Назначение теста"
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.tests
|
return self.tests.name_test
|
||||||
|
|
||||||
|
|
||||||
# Модель Сохраненных результатов
|
# Модель Сохраненных результатов
|
||||||
@@ -78,4 +78,4 @@ class SavedResultTest(models.Model):
|
|||||||
verbose_name = "Результаты тестирования"
|
verbose_name = "Результаты тестирования"
|
||||||
verbose_name_plural = "Результаты тестирования"
|
verbose_name_plural = "Результаты тестирования"
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.link_on_user
|
return self.link_on_user.fio
|
||||||
@@ -4,10 +4,8 @@ from rest_framework.response import Response
|
|||||||
class AllTestsPagination(LimitOffsetPagination):
|
class AllTestsPagination(LimitOffsetPagination):
|
||||||
# Переопределяем лимит по умолчанию
|
# Переопределяем лимит по умолчанию
|
||||||
default_limit = 1
|
default_limit = 1
|
||||||
|
|
||||||
# Максимальный лимит на странице
|
# Максимальный лимит на странице
|
||||||
max_limit = 3
|
max_limit = 3
|
||||||
|
|
||||||
def get_paginated_response(self, data):
|
def get_paginated_response(self, data):
|
||||||
|
|
||||||
return Response({
|
return Response({
|
||||||
@@ -18,3 +16,14 @@ class AllTestsPagination(LimitOffsetPagination):
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
class AppointmentUserPagination(LimitOffsetPagination):
|
||||||
|
default_limit = 1
|
||||||
|
max_limit = 3
|
||||||
|
def get_paginated_response(self, data):
|
||||||
|
return Response({
|
||||||
|
'total_count': self.count,
|
||||||
|
'limit': self.limit,
|
||||||
|
'offset': self.offset,
|
||||||
|
'results': data,
|
||||||
|
})
|
||||||
@@ -3,6 +3,7 @@ from .views import *
|
|||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('alltests/', GetAllTests.as_view(), name="getalltests")
|
path('alltests/', GetAllTests.as_view(), name="getalltests"),
|
||||||
|
path('appointmentusers/', GetAppointmentsUsers.as_view(), name="getappointmentusers"),
|
||||||
]
|
]
|
||||||
|
|
||||||
+13
-2
@@ -1,4 +1,4 @@
|
|||||||
|
from django.views.decorators.http import require_GET
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from .models import *
|
from .models import *
|
||||||
@@ -15,4 +15,15 @@ class GetAllTests(APIView):
|
|||||||
paginator = AllTestsPagination()
|
paginator = AllTestsPagination()
|
||||||
paginated_queryset = paginator.paginate_queryset(queryset,request)
|
paginated_queryset = paginator.paginate_queryset(queryset,request)
|
||||||
serializer = TestSerializer(paginated_queryset, many=True)
|
serializer = TestSerializer(paginated_queryset, many=True)
|
||||||
return paginator.get_paginated_response(serializer.data)
|
return paginator.get_paginated_response(serializer.data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class GetAppointmentsUsers(APIView):
|
||||||
|
def get(self, request):
|
||||||
|
id_user = request.GET.get('id')
|
||||||
|
queryset = SavedResultTest.objects.filter(link_on_user=id_user)
|
||||||
|
paginator = AppointmentUserPagination()
|
||||||
|
paginated_queryset = paginator.paginate_queryset(queryset, request)
|
||||||
|
serializer = SavedResultTestSerializer(paginated_queryset, many=True)
|
||||||
|
return paginator.get_paginated_response(serializer.data)
|
||||||
Reference in new issue
Block a user