Refactored the templates to extend a categories/base.html

This commit is contained in:
Corey Oordt 2010-12-18 14:46:37 -05:00
parent b5edbdcccb
commit 91227edccf
4 changed files with 34 additions and 3 deletions

View file

@ -0,0 +1,3 @@
{% extends 'base.html' %}
{% block content %}
{% endblock %}

View file

@ -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> <h2>{{ category }}</h2>
{% if category.parent %}<h3>Go up to <a href="{{ category.parent.get_absolute_url }}">{{ category.parent }}</a></h3>{% endif %} {% 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.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 %} {% 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 %}

View file

@ -1,2 +1,5 @@
{% extends 'categories/base.html' %}
{% block content %}
<h2>Categories</h2> <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 %}

View file

@ -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>