HTML之form表单和input系列

 1             <form method="POST" action="/host">
 2                 <input class="c1" type="text" name="id" placeholder="主机ID" />
 3                 <input type="text" name="hostname" placeholder="主机名" />
 4                 <input type="text" name="hostip" placeholder="主机IP" />
 5                 <input type="text" name="password" placeholder="密码" />
 6                 <select name="group_id">
 7                     {% for row in group_list %}
 8                     <option value={{row.id}}>{{ row.caption }}</option>
 9                     {% endfor %}
10                 </select>
11 
12 
13                 <input type="submit" value="添加"/>
14             </form>

表格 

 1             <table border="2">
 2                 <tr style="background-color: aquamarine">
 3                     <th class="c1">ID</th>
 4                     <th>主机名</th>
 5                     <th>主机IP</th>
 6                     <th>主机密码</th>
 7                     <th>业务部门</th>
 8                     <th>操作</th>
 9                     <th>操作</th>
10                 </tr>
11                 {% for row in host_list %}
12                 <tr>
13                     <td class="c1">{{ row.id }}</td>
14                     <td>{{ row.servername }}</td>
15                     <td>{{ row.serverip }}</td>
16                     <td>{{ row.serverpassword }}</td>
17                     <td>{{ row.server_group.caption }}</td>
18                     <td>编辑</td>
19                     <td class="i1">删除</td>
20                 </tr>
21                 {% endfor %}
22                 </table>

model 查询操作 

models.HostInfo.objects.filter(id=4 or id __gt=4  or  id__lt=4  or id__gte=4)
原文地址:https://www.cnblogs.com/liruixin/p/6254613.html