<form method="POST" action="/host">
<input class="c1" type="text" name="id" placeholder="主机ID" />
<input type="text" name="hostname" placeholder="主机名" />
<input type="text" name="hostip" placeholder="主机IP" />
<input type="text" name="password" placeholder="密码" />
<select name="group_id">
{% for row in group_list %}
<option value={{row.id}}>{{ row.caption }}</option>
{% endfor %}
</select> <input type="submit" value="添加"/>
</form>
表格
<table border="">
<tr style="background-color: aquamarine">
<th class="c1">ID</th>
<th>主机名</th>
<th>主机IP</th>
<th>主机密码</th>
<th>业务部门</th>
<th>操作</th>
<th>操作</th>
</tr>
{% for row in host_list %}
<tr>
<td class="c1">{{ row.id }}</td>
<td>{{ row.servername }}</td>
<td>{{ row.serverip }}</td>
<td>{{ row.serverpassword }}</td>
<td>{{ row.server_group.caption }}</td>
<td>编辑</td>
<td class="i1">删除</td>
</tr>
{% endfor %}
</table>
model 查询操作
models.HostInfo.objects.filter(id=4 or id __gt=4 or id__lt=4 or id__gte=4)