Skip to content

Commit

Permalink
fix error when changing category
Browse files Browse the repository at this point in the history
  • Loading branch information
maelys-buhler committed Apr 25, 2024
1 parent c33fbb8 commit 7214d4e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/masteriqapp/views/QuestionView.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class QuestionView(viewsets.ViewSet):
def new(self, request, pk):
category = get_object_or_404(self.queryset, pk=pk)
if 'question' in request.session:
actual_question = self.question_model.objects.get(self.question_model.objects.all(), pk=request.session['question'])
print(request.session['question'])
actual_question = self.question_model.objects.get(pk=request.session['question'])
if actual_question is not None and actual_question.category == category:
serializer = QuestionSerializer(actual_question)
return Response(serializer.data, status=status.HTTP_200_OK)
Expand Down

0 comments on commit 7214d4e

Please sign in to comment.