@require_POST
@login_required
def unsolve(request, question_id, answer_id):
 question = get_object_or_404(Question, pk=question_id)
 get_object_or_404(Answer, pk=answer_id)
 if (not question.allows_unsolve(request.user)):
  raise PermissionDenied
 if ((question.creator != request.user) and (not request.user.has_perm('questions.change_solution'))):
  return HttpResponseForbidden()
 question.solution = None
 question.save()
 question.remove_metadata('solver_id')
 statsd.incr('questions.unsolve')
 messages.add_message(request, messages.SUCCESS, _('The solution was undone successfully.'))
 return HttpResponseRedirect(question.get_absolute_url())

@ require_POST @ login_required def unsolve ( request , question_id , answer_id ) : question = get_object_or_404 ( Question , pk = question_id ) get_object_or_404 ( Answer , pk = answer_id ) if ( not question . allows_unsolve ( request . user ) ) : raise PermissionDenied if ( ( question . creator != request . user ) and ( not request . user . has_perm ( 'questions.change_solution' ) ) ) : return HttpResponseForbidden ( ) question . solution = None question . save ( ) question . remove_metadata ( 'solver_id' ) statsd . incr ( 'questions.unsolve' ) messages . add_message ( request , messages . SUCCESS , _ ( 'The solution was undone successfully.' ) ) return HttpResponseRedirect ( question . get_absolute_url ( ) )
accept an answer as the solution to the question .