def idc(req): context = {} if not req.user.is_authenticated(): return HttpResponseRedirect('/login/') username = req.session.get('username') import MySQLdb db = MySQLdb.connect(user='******', db='opsadmin', passwd='opsadmin', host='localhost', charset='utf8') cursor = db.cursor() #cursor.execute("SET NAMES 'gb2312'") cursor.execute('select * from opsadmin_idcnamelist') idcnamelist = cursor.fetchall() cursor.execute('select * from opsadmin_location') locationlist = cursor.fetchall() cursor.execute( 'select id,nodename,ipv4,sshport,status,location,idcname,is_virtual,serialnumber,cpu_model,harddisk,memory,ostype,buytime,qualitytime,detail from opsadmin_idcmanager' ) idcmanager_host_info = cursor.fetchall() db.close if req.method == "POST": print req.POST idcmanager = Idcmanager() idcmanager.nodename = req.POST.get('hostname') idcmanager.ipv4 = req.POST.get('ip') idcmanager.serialnumber = req.POST.get('serialnumber') idcmanager.sshport = req.POST.get('sshport') idcmanager.status = req.POST.get('status') idcmanager.location = req.POST.get('location') idcmanager.idcname = req.POST.get('idcname') idcmanager.ostype = req.POST.get('ostype') idcmanager.cpu = req.POST.get('cpu') idcmanager.harddisk = req.POST.get('harddisk') idcmanager.memory = req.POST.get('memory') idcmanager.buytime = req.POST.get('buytime') idcmanager.qualitytime = req.POST.get('qualitytime') idcmanager.detail = req.POST.get('detail') idcmanager.save() if req.method == "GET": #data=Idcnamelist.objects.all() #idcnamelist_dict=Idcnamelist.objects.order_by("id") #idcnamelist=idcnamelist_dict.values() #idcnamelist=Idcnamelist.objects.values() get = 'test' return render_to_response('idc-manager.html', { 'username': username, 'idcnamelist': idcnamelist, 'locationlist': locationlist, 'idcmanager_host_info': idcmanager_host_info }, context_instance=RequestContext(req))
def idc(req): context={} if not req.user.is_authenticated(): return HttpResponseRedirect('/login/') username=req.session.get('username') import MySQLdb db = MySQLdb.connect(user='******', db='opsadmin', passwd='opsadmin', host='localhost',charset='utf8') cursor=db.cursor() #cursor.execute("SET NAMES 'gb2312'") cursor.execute('select * from opsadmin_idcnamelist') idcnamelist=cursor.fetchall() cursor.execute('select * from opsadmin_location') locationlist=cursor.fetchall() cursor.execute('select id,nodename,ipv4,sshport,status,location,idcname,is_virtual,serialnumber,cpu_model,harddisk,memory,ostype,buytime,qualitytime,detail from opsadmin_idcmanager') idcmanager_host_info=cursor.fetchall() db.close if req.method == "POST": print req.POST idcmanager=Idcmanager() idcmanager.nodename=req.POST.get('hostname') idcmanager.ipv4=req.POST.get('ip') idcmanager.serialnumber=req.POST.get('serialnumber') idcmanager.sshport=req.POST.get('sshport') idcmanager.status=req.POST.get('status') idcmanager.location=req.POST.get('location') idcmanager.idcname=req.POST.get('idcname') idcmanager.ostype=req.POST.get('ostype') idcmanager.cpu=req.POST.get('cpu') idcmanager.harddisk=req.POST.get('harddisk') idcmanager.memory=req.POST.get('memory') idcmanager.buytime=req.POST.get('buytime') idcmanager.qualitytime=req.POST.get('qualitytime') idcmanager.detail=req.POST.get('detail') idcmanager.save() if req.method == "GET": #data=Idcnamelist.objects.all() #idcnamelist_dict=Idcnamelist.objects.order_by("id") #idcnamelist=idcnamelist_dict.values() #idcnamelist=Idcnamelist.objects.values() get='test' return render_to_response('idc-manager.html',{'username':username,'idcnamelist':idcnamelist,'locationlist':locationlist,'idcmanager_host_info':idcmanager_host_info},context_instance=RequestContext(req))
def idc(req): context={} if req.method == "POST": idcmanager=Idcmanager() idcmanager.hostname=req.POST.get('hostname') idcmanager.ip=req.POST.get('ip') idcmanager.serialnumber=req.POST.get('serialnumber') idcmanager.sshport=req.POST.get('sshport') idcmanager.status=req.POST.get('status') idcmanager.location=req.POST.get('location') idcmanager.idcname=req.POST.get('idcname') idcmanager.ostype=req.POST.get('ostype') idcmanager.cpu=req.POST.get('cpu') idcmanager.harddisk=req.POST.get('harddisk') idcmanager.memory=req.POST.get('memory') idcmanager.buytime=req.POST.get('buytime') idcmanager.qualitytime=req.POST.get('qualitytime') idcmanager.detail=req.POST.get('detail') idcmanager.save() return render_to_response('idc-manager.html')
def idc(req): context = {} if req.method == "POST": idcmanager = Idcmanager() idcmanager.hostname = req.POST.get('hostname') idcmanager.ip = req.POST.get('ip') idcmanager.serialnumber = req.POST.get('serialnumber') idcmanager.sshport = req.POST.get('sshport') idcmanager.status = req.POST.get('status') idcmanager.location = req.POST.get('location') idcmanager.idcname = req.POST.get('idcname') idcmanager.ostype = req.POST.get('ostype') idcmanager.cpu = req.POST.get('cpu') idcmanager.harddisk = req.POST.get('harddisk') idcmanager.memory = req.POST.get('memory') idcmanager.buytime = req.POST.get('buytime') idcmanager.qualitytime = req.POST.get('qualitytime') idcmanager.detail = req.POST.get('detail') idcmanager.save() return render_to_response('idc-manager.html')
def idc(req): context={} if not req.user.is_authenticated(): return HttpResponseRedirect('/login/') username=req.session.get('username') if req.method == "POST": idcmanager=Idcmanager() idcmanager.hostname=req.POST.get('hostname') idcmanager.ip=req.POST.get('ip') idcmanager.serialnumber=req.POST.get('serialnumber') idcmanager.sshport=req.POST.get('sshport') idcmanager.status=req.POST.get('status') idcmanager.location=req.POST.get('location') idcmanager.idcname=req.POST.get('idcname') idcmanager.ostype=req.POST.get('ostype') idcmanager.cpu=req.POST.get('cpu') idcmanager.harddisk=req.POST.get('harddisk') idcmanager.memory=req.POST.get('memory') idcmanager.buytime=req.POST.get('buytime') idcmanager.qualitytime=req.POST.get('qualitytime') idcmanager.detail=req.POST.get('detail') idcmanager.save() return render_to_response('idc-manager.html',{'username':username},context_instance=RequestContext(req))
def idc(req): context = {} if not req.user.is_authenticated(): return HttpResponseRedirect("/login/") username = req.session.get("username") if req.method == "POST": idcmanager = Idcmanager() idcmanager.hostname = req.POST.get("hostname") idcmanager.ip = req.POST.get("ip") idcmanager.serialnumber = req.POST.get("serialnumber") idcmanager.sshport = req.POST.get("sshport") idcmanager.status = req.POST.get("status") idcmanager.location = req.POST.get("location") idcmanager.idcname = req.POST.get("idcname") idcmanager.ostype = req.POST.get("ostype") idcmanager.cpu = req.POST.get("cpu") idcmanager.harddisk = req.POST.get("harddisk") idcmanager.memory = req.POST.get("memory") idcmanager.buytime = req.POST.get("buytime") idcmanager.qualitytime = req.POST.get("qualitytime") idcmanager.detail = req.POST.get("detail") idcmanager.save() return render_to_response("idc-manager.html", {"username": username}, context_instance=RequestContext(req))