@login_required
def delete_answer(request, question_id, answer_id):
 answer = get_object_or_404(Answer, pk=answer_id, question=question_id)
 if (not answer.allows_delete(request.user)):
  raise PermissionDenied
 if (request.method == 'GET'):
  return render(request, 'questions/confirm_answer_delete.html', {'answer': answer})
 log.warning(('User %s is deleting answer with id=%s' % (request.user, answer.id)))
 answer.delete()
 statsd.incr('questions.delete_answer')
 return HttpResponseRedirect(reverse('questions.details', args=[question_id]))

@ login_required def delete_answer ( request , question_id , answer_id ) : answer = get_object_or_404 ( Answer , pk = answer_id , question = question_id ) if ( not answer . allows_delete ( request . user ) ) : raise PermissionDenied if ( request . method == 'GET' ) : return render ( request , 'questions/confirm_answer_delete.html' , { 'answer' : answer } ) log . warning ( ( 'User %s is deleting answer with id=%s' % ( request . user , answer . id ) ) ) answer . delete ( ) statsd . incr ( 'questions.delete_answer' ) return HttpResponseRedirect ( reverse ( 'questions.details' , args = [ question_id ] ) )
delete an answer .