@permission_required('questions.tag_question')
@require_POST
def remove_tag(request, question_id):
 prefix = 'remove-tag-'
 names = [k for k in request.POST if k.startswith(prefix)]
 if names:
  name = names[0][len(prefix):]
  question = get_object_or_404(Question, pk=question_id)
  question.tags.remove(name)
  question.clear_cached_tags()
 return HttpResponseRedirect(reverse('questions.details', args=[question_id]))

@ permission_required ( 'questions.tag_question' ) @ require_POST def remove_tag ( request , question_id ) : prefix = 'remove-tag-' names = [ k for k in request . POST if k . startswith ( prefix ) ] if names : name = names [ 0 ] [ len ( prefix ) : ] question = get_object_or_404 ( Question , pk = question_id ) question . tags . remove ( name ) question . clear_cached_tags ( ) return HttpResponseRedirect ( reverse ( 'questions.details' , args = [ question_id ] ) )
removes tag from the record .