zoukankan      html  css  js  c++  java
  • django 将一维数组交给前台页面

    def testjquery(req):
     print req.get_full_path()
     print req.GET['username'];
     print req.GET['content'];
     d=[]
     d.append(req.GET['username'])
     d.append(req.GET['content'])
     print type(d)
     print d
     return HttpResponse( req.GET['username'] + req.GET['content'])
     
     return render(req,'cmdb/modifyBtn.html',{'info':info})
     
     def testjquery(req):
     print req.get_full_path()
     print req.GET['username'];
     print req.GET['content'];
     d=[]
     d.append(req.GET['username'])
     d.append(req.GET['content'])
     print type(d)
     print d
     return render(req,'testjquery.html',{'info':d})
     
     [22/Jan/2018 12:52:54] "GET /testjquery/?username=123&content=789 HTTP/1.1" 200 614
    /testjquery/?username=123&content=789
    123
    789
    <type 'list'>
    [u'123', u'789']
    [22/Jan/2018 12:52:55] "GET /testjquery/?username=123&content=789 HTTP/1.1" 200 614
    
     
     将数组分配给前台页面
     
     {% for x in info %}  
      <label class="condition">地址</label><input type="text" name="ip" class="equipment_sz" value={{x.0}}>  
      <label class="condition">描述</label><input type="text" name="info" class="equipment_sz" value={{x.1}}>  
      
      node2:/django/mysite/news/templates#cat testjquery.html 
                <form id="condition" action="/static/modifyEquipment" method="post">  
                                    {% for x in info %}  
                    <label class="condition">值</label><input type="text" name="ip" class="equipment_sz" value={{x}}>  
                    <input type="submit" value="设备修改" class="equipment_add_btn">  
                                    {% endfor %}  
                </form>  

  • 相关阅读:
    P1006 传纸条
    P1387 最大正方形
    P1417 烹调方案
    P1052 过河
    P1063 能量项链
    P1736 创意吃鱼法
    P1156 垃圾陷阱
    P1220 关路灯
    @P1373 小a和uim之大逃离
    【leetcode】Interleaving String
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349290.html
Copyright © 2011-2022 走看看