首页 > 其他 > 详细

车主信息

时间:2019-03-14 11:17:23      阅读:167      评论:0      收藏:0      [点我收藏+]

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>

车主信息

原文:https://www.cnblogs.com/putinsong/p/10528983.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!