feat [P-227]: удаление назначенных тестов в том числе
This commit is contained in:
1 parent
400d2ca5f0
commit
bc7889cb62
3 files changed
+74
No files matched your search
@@ -209,6 +209,38 @@ class TestingView(generics.ListCreateAPIView):
|
||||
queryset = Testing.objects.all()
|
||||
serializer_class = TestingSeriaizer
|
||||
pagination_class = None
|
||||
|
||||
@swagger_auto_schema(
|
||||
operation_description="""Получить все назначения теста
|
||||
*Нужно авторизоваться!""",
|
||||
manual_parameters=[
|
||||
openapi.Parameter(
|
||||
'test_id',
|
||||
openapi.IN_QUERY,
|
||||
description="ID теста",
|
||||
type=openapi.TYPE_INTEGER,
|
||||
required=False,
|
||||
),
|
||||
],
|
||||
responses={
|
||||
200: "success",
|
||||
400: 'error',
|
||||
}
|
||||
)
|
||||
def get(self, request):
|
||||
"""Get all testing records for a test"""
|
||||
test_id = request.query_params.get('test_id')
|
||||
try:
|
||||
if test_id:
|
||||
testings = Testing.objects.filter(test_id=test_id)
|
||||
else:
|
||||
testings = Testing.objects.all()
|
||||
|
||||
serializer = self.get_serializer(testings, many=True)
|
||||
return Response(serializer.data)
|
||||
except DatabaseError as e:
|
||||
print(e)
|
||||
return Response({"status": "error", "message": str(e)}, status=400)
|
||||
|
||||
def post(self, request):
|
||||
"""create testing"""
|
||||
|
||||
Reference in new issue
Block a user