@require_POST
def update_tags(request):
  response = {'status': -1, 'message': ''}

  request_json = json.loads(request.POST['data'])
  try:
    doc = DocumentTag.objects.update_tags(request.user, request_json['doc_id'], request_json['tag_ids'])
    response['doc'] = massage_doc_for_json(doc, request.user)
    response['status'] = 0
  except __HOLE__, e:
    response['message'] = _('Form is missing %s field') % e.message
  except Exception, e:
    response['message'] = force_unicode(e)

  return JsonResponse(response)
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/api.py/update_tags