@permission_required('questions.tag_question')
@require_POST
def add_tag_async(request, question_id):
 try:
  (question, canonical_name) = _add_tag(request, question_id)
 except Tag.DoesNotExist:
  return HttpResponse(json.dumps({'error': unicode(UNAPPROVED_TAG)}), content_type='application/json', status=400)
 if canonical_name:
  question.clear_cached_tags()
  tag = Tag.objects.get(name=canonical_name)
  tag_url = urlparams(reverse('questions.list', args=[question.product_slug]), tagged=tag.slug)
  data = {'canonicalName': canonical_name, 'tagUrl': tag_url}
  return HttpResponse(json.dumps(data), content_type='application/json')
 return HttpResponse(json.dumps({'error': unicode(NO_TAG)}), content_type='application/json', status=400)

@ permission_required ( 'questions.tag_question' ) @ require_POST def add_tag_async ( request , question_id ) : try : ( question , canonical_name ) = _add_tag ( request , question_id ) except Tag . DoesNotExist : return HttpResponse ( json . dumps ( { 'error' : unicode ( UNAPPROVED_TAG ) } ) , content_type = 'application/json' , status = 400 ) if canonical_name : question . clear_cached_tags ( ) tag = Tag . objects . get ( name = canonical_name ) tag_url = urlparams ( reverse ( 'questions.list' , args = [ question . product_slug ] ) , tagged = tag . slug ) data = { 'canonicalName' : canonical_name , 'tagUrl' : tag_url } return HttpResponse ( json . dumps ( data ) , content_type = 'application/json' ) return HttpResponse ( json . dumps ( { 'error' : unicode ( NO_TAG ) } ) , content_type = 'application/json' , status = 400 )
add a tag to question asyncronously .