列表查询
前端
<table class="table table-hover table-bordered">
<tr>
<th>序号</th>
<th>数量</th>
<th>价格</th>
</tr>
{% for one in queryset %}
<tr user-id="{{ one.id }}">
<td>{{ one.id }}</td>
<td>{{ one.count }}</td>
<td>{{ one.price }}</td>
</tr>
{% endfor %}
</table>
后端
def price_policy_list(request):
if request.method == 'GET':
queryset = models.PricePolicy.objects.all()
context = {
'queryset': queryset
}
return render(request, 'pricePolicy/list.html', context)