车主信息

1. 创建customer页面

2.urls新增地址

3.views增加方法

4.怎样获取model的字段名?

def detail(request):
# types = User_detail.objects.all()
# context = {'types': types}
# print(User_detail.objects.all())
model_obj = get_model('customer','User_detail')
typedict = {}
for types in model_obj._meta.fields:
typedict[types.name] = types.verbose_name
    return render(request, 'customer.html',{'typedict':typedict})
<tr>
<th>
<input type="checkbox" name="" checked=""> 全选
</th>
<th>
{{ typedict.user_name}}
</th>
<th>
{{ typedict.car_no}}
</th>
<th>
{{ typedict.phone}}
</th>
<th>
{{ typedict.create_time}}
</th>

posted @ 2019-03-14 11:11  PutinSong  阅读(106)  评论(0编辑  收藏  举报