(request)
return HttpResponse(json.dumps(content, ensure_ascii=False, indent=4))
:param request:
    :return:
def ZtreeIndex(request):
    """

    :param request:
    :return:
    """
    if request.method == 'POST':
        otherParam = request.POST.get("otherParam")
        status = request.POST.get("status")
        line_id = request.POST.get("line_id")

        try:
            name = request.POST.get("name")
            id = request.POST.get("id")

        except:
            name = False

        if not name:
            ztree = ztree_tag(request.user.username)
            return HttpResponse(json.dumps(ztree, ensure_ascii=False, indent=4))

        elif int(status[0]) == 1:
            ztree = []
            return HttpResponse(json.dumps(ztree, ensure_ascii=False, indent=4))

        else:
            ztree = []
            bus_data = Project.objects.get(service_name=name)
            server_list = Host.objects.filter(business=bus_data).order_by("create_time")

            s = []
            for i in server_list:
                t = i.service.all().values()
                for b in t:
                    if b not in s:
                        s.append(b)
            tree_id = 0
            for i in s:
                tree_id += 1

                token = hashlib.sha1(request.user.username + auth_key + i.get("name") + time.strftime('%Y-%m-%d',
                                                                                                      time.localtime(
                                                                                                              time.time()))).hexdigest()

                ztree.append({"id": tree_id, "status": 3, "line_id": line_id, "name": i.get("name"), "token": token,
                              "t": i.get("name"), "business": bus_data.service_name})

            return HttpResponse(json.dumps(ztree, ensure_ascii=False, indent=4))
    content = {"status": 403, "message": "auth error"}
    return HttpResponse(json.dumps(content, ensure_ascii=False, indent=4))
def ZtreeIndex ( request ) : if request . method == 'POST' : otherParam = request . POST . get ( "otherParam" ) status = request . POST . get ( "status" ) line_id = request . POST . get ( "line_id" ) try : name = request . POST . get ( "name" ) id = request . POST . get ( "id" ) except : name = False if not name : ztree = ztree_tag ( request . user . username ) return HttpResponse ( json . dumps ( ztree , ensure_ascii = False , indent = 4 ) ) elif int ( status [ 0 ] ) == 1 : ztree = [ ] return HttpResponse ( json . dumps ( ztree , ensure_ascii = False , indent = 4 ) ) else : ztree = [ ] bus_data = Project . objects . get ( service_name = name ) server_list = Host . objects . filter ( business = bus_data ) . order_by ( "create_time" ) s = [ ] for i in server_list : t = i . service . all ( ) . values ( ) for b in t : if b not in s : s . append ( b ) tree_id = 0 for i in s : tree_id += 1 token = hashlib . sha1 ( request . user . username + auth_key + i . get ( "name" ) + time . strftime ( '%Y-%m-%d' , time . localtime ( time . time ( ) ) ) ) . hexdigest ( ) ztree . append ( { "id" : tree_id , "status" : 3 , "line_id" : line_id , "name" : i . get ( "name" ) , "token" : token , "t" : i . get ( "name" ) , "business" : bus_data . service_name } ) return HttpResponse ( json . dumps ( ztree , ensure_ascii = False , indent = 4 ) ) content = { "status" : 403 , "message" : "auth error" } return HttpResponse ( json . dumps ( content , ensure_ascii = False , indent = 4 ) )