前端页面:
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="{% static 'plugins/bootstrap-3.3.7-dist/css/bootstrap.min.css' %}">
</head>
<body>
<div class="container">
<h1>编辑物资信息</h1>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<a href="/add_store/" class="btn btn-primary">添加仓库信息</a>
<table style="margin-top: 10px;" class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>编号</th>
<th>仓库编号</th>
<th>仓库地址</th>
<th>物资编号</th>
<th>物资数量</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{% for store in store %}
<tr>
<td>{{ forloop.counter }}</td>
<td>{{ store.warehouseId }}</td>
<td>{{ store.warehouseAddress }}</td>
</tr>
{% endfor %}
{% for good in goods %}
<tr>
<td>{{ good.type_name }}</td>
<td>{{ good.num }}</td>
<td>
<a href="{% url '' %}" class="btn btn-warning">编辑</a>
<a href="{% url '' %}" class="btn btn-danger">删除</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>
models:
class warehouseInfo(models.Model):
warehouseId = models.IntegerField(verbose_name=u'仓库编号',null=True)
warehouseAddress = models.CharField(verbose_name=u'仓库地址', max_length=20, null=True)
views:
def warehouse(request):
store = models.warehouseInfo.objects.all()
goods = models.logisticsInfo.objects.all()
return render(request, 'warehouse.html',{'store':store,'goods':goods})
urls:
url(r'',include('warehouse.urls')),
明明数据库里已经添加了信息,但是页面上就是没有,救救孩子吧!