32 lines
694 B
Java
32 lines
694 B
Java
<h2>Comment</h2>
|
|
<pre><code>{# This is a comment #}</code></pre>
|
|
|
|
<h2>Variable</h2>
|
|
<pre><code>{{ some_variable }}</code></pre>
|
|
|
|
<h2>Template Tag</h2>
|
|
<pre><code>{% if some_condition %}
|
|
Conditional block
|
|
{% endif %}
|
|
</code></pre>
|
|
|
|
<h2>Full Example</h2>
|
|
<pre><code>{# This a Django template example #}
|
|
{% extends "base_generic.html" %}
|
|
|
|
{% block title %}{{ section.title }}{% endblock %}
|
|
|
|
{% block content %}
|
|
<h1>{{ section.title }}</h1>
|
|
|
|
{% for story in story_list %}
|
|
<h2>
|
|
<a href="{{ story.get_absolute_url }}">
|
|
{{ story.headline|upper }}
|
|
</a>
|
|
</h2>
|
|
<p>{{ story.tease|truncatewords:"100" }}</p>
|
|
{% endfor %}
|
|
{% endblock %}
|
|
</code></pre>
|