'Accept an answer as the solution to the question.'

@detail_route(methods=['POST'])
def solve(self, request, pk=None):

    question = self.get_object()
    answer_id = request.data.get('answer')
    try:
        answer = Answer.objects.get(pk=answer_id)
    except Answer.DoesNotExist:
        return Response({'answer': 'This    field    is    required.'}, status=status.HTTP_400_BAD_REQUEST)
    question.set_solution(answer, request.user)
    return Response(status=status.HTTP_204_NO_CONTENT)
