Skip to content

Commit

Permalink
Refactored the templates to extend a categories/base.html
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey Oordt committed Dec 18, 2010
1 parent b5edbdc commit 91227ed
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
3 changes: 3 additions & 0 deletions categories/templates/categories/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% extends 'base.html' %}
{% block content %}
{% endblock %}
17 changes: 15 additions & 2 deletions categories/templates/categories/category_detail.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
{% extends 'categories/base.html' %}
{% load category_tags %}
{% block content %}
<p><tt>breadcrumbs category</tt> result: </p>
{% breadcrumbs category %}
<p><tt>breadcrumbs category ">"</tt> result: </p>
{% breadcrumbs category ">" %}
<p><tt>display_path_as_ul category</tt> result:</p>
{% display_path_as_ul category %}
<p><tt>display_drilldown_as_ul category</tt> result:</p>
{% display_drilldown_as_ul category %}
<p><tt>category.get_ancestors|category_path</tt> filter result: {{ category.get_ancestors|category_path }}</p>
<h2>{{ category }}</h2>
{% if category.parent %}<h3>Go up to <a href="{{ category.parent.get_absolute_url }}">{{ category.parent }}</a></h3>{% endif %}
<p>{{ category.description }}</p>
{% if category.children.count %}<h3>Subcategories</h3><ul>{% for child in category.children.all %}<li><a href="{{ child.get_absolute_url }}">{{ child }}</a></li>{% endfor %}</ul>{% endif %}
{% if category.description %}<p>{{ category.description }}</p>{% endif %}
{% if category.children.count %}<h3>Subcategories</h3><ul>{% for child in category.children.all %}<li><a href="{{ child.get_absolute_url }}">{{ child }}</a></li>{% endfor %}</ul>{% endif %}
{% endblock %}
5 changes: 4 additions & 1 deletion categories/templates/categories/category_list.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
{% extends 'categories/base.html' %}
{% block content %}
<h2>Categories</h2>
<ul>{% for category in object_list %}<li><a href="{{ category.get_absolute_url }}">{{ category }}</a></li>{% endfor %}</ul>
<ul>{% for category in object_list %}<li><a href="{{ category.get_absolute_url }}">{{ category }}</a></li>{% endfor %}</ul>
{% endblock %}
12 changes: 12 additions & 0 deletions example/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Django Categories</title>
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>

0 comments on commit 91227ed

Please sign in to comment.