mirror of
https://github.com/jazzband/django-categories.git
synced 2026-03-16 22:30:24 +00:00
Refactored the templates to extend a categories/base.html
This commit is contained in:
parent
b5edbdcccb
commit
91227edccf
4 changed files with 34 additions and 3 deletions
3
categories/templates/categories/base.html
Normal file
3
categories/templates/categories/base.html
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
|
|
@ -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 %}
|
||||
|
|
@ -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
example/templates/base.html
Normal file
12
example/templates/base.html
Normal 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>
|
||||
Loading…
Reference in a new issue