| 1 | <h2>Comment</h2> |
| 2 | <pre><code>{# This is a comment #}</code></pre> |
| 3 | |
| 4 | <h2>Variable</h2> |
| 5 | <pre><code>{{ some_variable }}</code></pre> |
| 6 | |
| 7 | <h2>Template Tag</h2> |
| 8 | <pre><code>{% if some_condition %} |
| 9 | Conditional block |
| 10 | {% endif %} |
| 11 | </code></pre> |
| 12 | |
| 13 | <h2>Full Example</h2> |
| 14 | <pre><code>{# This is a Django template example #} |
| 15 | {% extends "base_generic.html" %} |
| 16 | |
| 17 | {% block title %}{{ section.title }}{% endblock %} |
| 18 | |
| 19 | {% block content %} |
| 20 | <h1>{{ section.title }}</h1> |
| 21 | |
| 22 | {% for story in story_list %} |
| 23 | <h2> |
| 24 | <a href="{{ story.get_absolute_url }}"> |
| 25 | {{ story.headline|upper }} |
| 26 | </a> |
| 27 | </h2> |
| 28 | <p>{{ story.tease|truncatewords:"100" }}</p> |
| 29 | {% endfor %} |
| 30 | {% endblock %} |
| 31 | </code></pre> |