标签:inf img info open extends views context view end
pycharm 远程同步配置 会出问题 不自动同步
1.常用的模板标签
-作用是什么?
-常用标签
总结:语法
{% tag %} {% endtag %}
{% tag 参数 参数 %}
案例:
views.py设置把里面的index 里面的students以表格形式显示
1 def index(request): 2 3 students = [ 4 {‘id‘: 10, ‘name‘: ‘张三‘, ‘age‘: 18, ‘sex‘: ‘男‘}, 5 {‘id‘: 11, ‘name‘: ‘李四‘, ‘age‘: 19, ‘sex‘: ‘女‘}, 6 {‘id‘: 22, ‘name‘: ‘王五‘, ‘age‘: 18, ‘sex‘: ‘男‘}, 7 {‘id‘: 138, ‘name‘: ‘赵柳‘, ‘age‘: 16, ‘sex‘: ‘女‘}, 8 {‘id‘: 90, ‘name‘: ‘钱七‘, ‘age‘: 25, ‘sex‘: ‘男‘}, 9 ] 10 return render(request, ‘teacher/index.html‘, context={ 11 ‘students‘: students 12 })
2.模板的继承与引用
-引用 include标签
-继承 extends标签
block
标签:inf img info open extends views context view end
原文地址:https://www.cnblogs.com/donghao1121/p/10427941.html