P-81
This commit is contained in:
1 parent
bc100b47ad
commit
de3bb4fdc6
4 files changed
+22
-4
No files matched your search
+14
-1
@@ -14,9 +14,22 @@ import os
|
||||
from django.conf import settings
|
||||
from django.urls import reverse
|
||||
import html
|
||||
from rest_framework.permissions import IsAuthenticated
|
||||
|
||||
class TestDetail(generics.RetrieveUpdateDestroyAPIView):
|
||||
queryset = Test.objects.all()
|
||||
serializer_class = TestSerializer
|
||||
lookup_url_kwarg = 'id'
|
||||
lookup_field = 'id'
|
||||
lookup_field = 'id'
|
||||
|
||||
class GetTesting(APIView):
|
||||
|
||||
def get(self, request):
|
||||
user = request.user
|
||||
tests = Testing.objects.filter(user=user)
|
||||
test_names = {test.id: test.test.name for test in tests}
|
||||
serializer = TestingSeriaizer(tests, many=True).data
|
||||
for test in serializer:
|
||||
if test['id'] in test_names:
|
||||
test['test_name'] = test_names[test['id']]
|
||||
return Response(serializer)
|
||||
Reference in new issue
Block a user