(request)
新增资产
    :param request:
    :return:
新增资产
    :param request:
    :return:
新增资产 : param request : : return :
def addasset(request):
    '''
    新增资产
    :param request:
    :return:
    '''
    if request.user == "AnonymousUser":
        return HttpResponse("0")
    if request.method == "POST":
        try:
            try:
                print(request.POST)
                asset_domain = request.POST['asset_domain']
                # user = request.user
                newasset = domain_ip.objects.get_or_create(subdomain=asset_domain)
                print("保存成功")
                return HttpResponse("1")
            except Exception as e:
                raise Exception()
        except ObjectDoesNotExist as e:
            return HttpResponse("2")

    if request.method == "GET":
        # 查询出所有的资产
        return render(request,"asset_add.html")
def addasset ( request ) : if request . user == "AnonymousUser" : return HttpResponse ( "0" ) if request . method == "POST" : try : try : print ( request . POST ) asset_domain = request . POST [ 'asset_domain' ] # user = request.user newasset = domain_ip . objects . get_or_create ( subdomain = asset_domain ) print ( "保存成功") return HttpResponse ( "1" ) except Exception as e : raise Exception ( ) except ObjectDoesNotExist as e : return HttpResponse ( "2" ) if request . method == "GET" : # 查询出所有的资产 return render ( request , "asset_add.html" )