标签:style blog color os for div html htm
index.html
{% extends "base.html" %} {% block content %} <h1>Hi, {{user.nickname}}!</h1> {% for post in posts %} <div><p>{{post.author.nickname}} says: <b>{{post.body}}</b></p></div> {% endfor %} {% endblock %}
base.html
<html> <head> {% if title %} <title>{{title}} - microblog</title> {% else %} <title>microblog</title> {% endif %} </head> <body> <div>Microblog: <a href="/index">Home</a></div> <hr> {% block content %}{% endblock %} </body> </html>
关键语句:{% block content %} wz {% endblock %} ; {% extends,‘base.html‘ %} {% block content %} xxxxxx{% endblock %}
index.html 继承 base.html 简单理解,将xxxxxx插入wz位置,但最终渲染的模板是 base.html
标签:style blog color os for div html htm
原文地址:http://www.cnblogs.com/xiaoyutongxue/p/3891063.html