chore [P-01]: подтянул бэк
This commit is contained in:
commit
d5d15bb26f
1 file changed
+6
-2
@@ -227,12 +227,16 @@ class TestingView(generics.ListCreateAPIView):
|
|||||||
)
|
)
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
"""Get all testing records for a test"""
|
"""Get all testing records for a test"""
|
||||||
|
user = request.user
|
||||||
test_id = request.query_params.get('test_id')
|
test_id = request.query_params.get('test_id')
|
||||||
try:
|
try:
|
||||||
if test_id:
|
if test_id:
|
||||||
testings = Testing.objects.filter(test_id=test_id).select_related('user__user')
|
testings = Testing.objects.filter(test_id=test_id,
|
||||||
|
is_active=True,
|
||||||
|
user=user).select_related('user__user')
|
||||||
else:
|
else:
|
||||||
testings = Testing.objects.all().select_related('user__user')
|
testings = Testing.objects.filter(is_active=True,
|
||||||
|
user=user).select_related('user__user')
|
||||||
|
|
||||||
serializer = self.get_serializer(testings, many=True)
|
serializer = self.get_serializer(testings, many=True)
|
||||||
return Response(serializer.data)
|
return Response(serializer.data)
|
||||||
|
|||||||
Reference in new issue
Block a user