Django for Designers: Difference between revisions
Content added Content deleted
imported>Paulproteus (→Handling URLs with templates: Spaces, not tabs) |
imported>Paulproteus (→Django templates 101: More tab=>space fixes) |
||
Line 458: | Line 458: | ||
<source lang="python"> |
<source lang="python"> |
||
def tag(request, tag_name): |
def tag(request, tag_name): |
||
context = { |
|||
'tag': tag_name, |
|||
} |
|||
} |
|||
return render(request, 'tag.html', context) |
|||
</source> |
</source> |
||
Line 504: | Line 504: | ||
<html> |
<html> |
||
<head> |
<head> |
||
<title>My bookmarking app</title> |
|||
</head> |
</head> |
||
<body> |
<body> |
||
<div id="header"> |
|||
<h1>My bookmarking app</h1> |
|||
</div> |
|||
<div id="content"> |
|||
<h2>{% block subheader %}{% endblock %}</h2> |
|||
{% block content %} |
|||
Sample content -- you should never see this, unless an inheriting template fails to have any content block! |
|||
{% endblock %} |
|||
</div> |
|||
<div id="footer"> |
|||
Brought to you by PyCon US 2013 |
|||
</div> |
|||
</body> |
</body> |
||
</html> |
</html> |
||
Line 535: | Line 535: | ||
{% block content %} |
{% block content %} |
||
<ul> |
<ul> |
||
<li>Bookmark</li> |
|||
<li>Another bookmark</li> |
|||
<li>A third bookmark</li> |
|||
</ul> |
</ul> |
||
{% endblock %} |
{% endblock %} |