@permission_required('flagit.can_moderate')
@require_POST
def unmark_spam(request):
 if request.POST.get('question_id'):
  question_id = request.POST.get('question_id')
  obj = get_object_or_404(Question, pk=question_id)
 else:
  answer_id = request.POST.get('answer_id')
  obj = get_object_or_404(Answer, pk=answer_id)
  question_id = obj.question.id
 obj.is_spam = False
 obj.marked_as_spam = None
 obj.marked_as_spam_by = None
 obj.save()
 return HttpResponseRedirect(reverse('questions.details', kwargs={'question_id': question_id}))

@ permission_required ( 'flagit.can_moderate' ) @ require_POST def unmark_spam ( request ) : if request . POST . get ( 'question_id' ) : question_id = request . POST . get ( 'question_id' ) obj = get_object_or_404 ( Question , pk = question_id ) else : answer_id = request . POST . get ( 'answer_id' ) obj = get_object_or_404 ( Answer , pk = answer_id ) question_id = obj . question . id obj . is_spam = False obj . marked_as_spam = None obj . marked_as_spam_by = None obj . save ( ) return HttpResponseRedirect ( reverse ( 'questions.details' , kwargs = { 'question_id' : question_id } ) )
mark a question or an answer as spam .