рефакторинг
This commit is contained in:
1 parent
a8d49830a8
commit
defad1291a
1 file changed
+4
-4
@@ -51,7 +51,7 @@ class GetTests(generics.ListAPIView):
|
|||||||
400: 'error',
|
400: 'error',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
def get (self, request):
|
def get (self, request, *args, **kwargs):
|
||||||
"""receives tests assigned to the user"""
|
"""receives tests assigned to the user"""
|
||||||
user = request.user
|
user = request.user
|
||||||
# user = User.objects.get(username='9966-00-125')
|
# user = User.objects.get(username='9966-00-125')
|
||||||
@@ -124,7 +124,7 @@ class TestDetail(generics.RetrieveUpdateDestroyAPIView):
|
|||||||
lookup_url_kwarg = 'id'
|
lookup_url_kwarg = 'id'
|
||||||
lookup_field = 'id'
|
lookup_field = 'id'
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request, *args, **kwargs):
|
||||||
"""Processes a GET request to retrieve detailed information about a test."""
|
"""Processes a GET request to retrieve detailed information about a test."""
|
||||||
test = self.get_object()
|
test = self.get_object()
|
||||||
number_of_questions = test.question_count
|
number_of_questions = test.question_count
|
||||||
@@ -405,7 +405,7 @@ class TestResultView(generics.ListCreateAPIView):
|
|||||||
400: 'error',
|
400: 'error',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
def get(self, request):
|
def get(self, request, *args, **kwargs):
|
||||||
"""Get the results of the last user test attempt."""
|
"""Get the results of the last user test attempt."""
|
||||||
user = request.user
|
user = request.user
|
||||||
# user = User.objects.get(username = "9966-00-125")
|
# user = User.objects.get(username = "9966-00-125")
|
||||||
@@ -448,7 +448,7 @@ class TestResultView(generics.ListCreateAPIView):
|
|||||||
400: 'error',
|
400: 'error',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
def post(self, request):
|
def post(self, request, *args, **kwargs):
|
||||||
"""Saves the results of a new test attempt."""
|
"""Saves the results of a new test attempt."""
|
||||||
try:
|
try:
|
||||||
user = request.user
|
user = request.user
|
||||||
|
|||||||
Reference in new issue
Block a user