模板并非只有HTML。模版是纯文本文件,可以生成任何基于文本的文件格式,比如HTML,XML,CSV等。
{% extends "base_generic.html" %}…………………………………………………………………… 模板继承{% block title %}{{ section.title }}{% endblock %}{% block content %}<h1>{{ section.title }}</h1>{% for story in story_list %}…………………………………………………………………… {% for...in... %}标签<h2><a href="{{ story.get_absolute_url }}">{{ story.headline|upper }} ………………………………………… upper过滤器</a></h2><p>{{ story.tease|truncatewords:"100" }}</p>{% endfor %}{% endblock %}
