Django模板举例代码
来源:互联网 发布:ubuntu系统的全面备份 编辑:程序博客网 时间:2024/05/19 23:15
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
{{ k1 }}
{{ k2.0 }}
{{ k3.name }}
{% for item in k2 %}
<p>{{ item }},{{ forloop.counter }},{{ forloop.counter0 }},{{ forloop.first }},{{ forloop.last }},{{ forloop.revcounter }}</p>
{% endfor %}
{% if k1 == "v1" %}
<h1>K1</h1>
{% elif k1 == "v2" %}
<h1>K2</h1>
{% else %}
<h1>777</h1>
{% endif %}
{{ k1|lower }}
{{ k3.name|upper }}
</body>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
{{ k1 }}
{{ k2.0 }}
{{ k3.name }}
{% for item in k2 %}
<p>{{ item }},{{ forloop.counter }},{{ forloop.counter0 }},{{ forloop.first }},{{ forloop.last }},{{ forloop.revcounter }}</p>
{% endfor %}
{% if k1 == "v1" %}
<h1>K1</h1>
{% elif k1 == "v2" %}
<h1>K2</h1>
{% else %}
<h1>777</h1>
{% endif %}
{{ k1|lower }}
{{ k3.name|upper }}
</body>
</html>
Python代码
def template(requests):
return render(requests,"template.html",{"k1":"VVV","k2":[11,22,33,44,55], 'k3':{'name':"Alex","nid":12 }})
0 0
- Django模板举例代码
- django分页代码举例
- Django模板(编写html代码
- django模板
- django模板
- Django 模板
- Django----模板
- django 模板
- Django 模板
- Django 模板
- Django - 模板
- Django-模板
- Django 模板
- Django模板
- Django-模板
- Django模板
- Django 模板
- C++模板特化举例
- meanshift跟踪算法详解
- [JavaEE - JPA] 7. ORM的核心注解 - 关系类型
- 走进设计模式(二)-结构型模式
- Codeforces Round #376 (Div. 2) 题解
- poj 1797 路径问题 dijkstra改写
- Django模板举例代码
- CCF 201612-2 火车购票 JAVA实现
- Hadoop家族技能图谱
- iText7---Adding low-level content添加低层级内容
- I Hate It
- 【openjudge 计算概论(A)】[基础编程练习(控制成分)]
- poj2299Ultra-QuickSort(树状数组+离散化)
- python中使用elasticsearch做为搜索引擎
- Micro Focus COBOL multi-thread programming