Django Categories v0.7beta1 documentation

This Page

Template Tags

get_top_level_categories

Retrieves an alphabetical list of all the categories that have no parents.

Syntax:

{% get_top_level_categories as categories %}

Returns an list of categories [<category>, <category>, <category, ...]

display_path_as_ul

Render the category with ancestors, but no children using the categories/ul_tree.html template.

Example:

{% display_path_as_ul "/Grandparent/Parent" %}

or

{% display_path_as_ul category_obj %}

Returns:

<ul>
  <li><a href="/categories/">Top</a>
  <ul>
    <li><a href="/categories/grandparent/">Grandparent</a></li>
  </ul>
  </li>
</ul>

get_category_drilldown

Retrieves the specified category, its ancestors and its immediate children as an iterable.

Example:

{% get_category_drilldown "/Grandparent/Parent" as family %}

or

{% get_category_drilldown category_obj as family %}

Sets family to:

[Grandparent, Parent, Child 1, Child 2, Child n]

display_drilldown_as_ul

Render the category with ancestors and children using the categories/ul_tree.html template.

Example:

{% display_drilldown_as_ul "/Grandparent/Parent" %}

or:

{% display_drilldown_as_ul category_obj %}

Returns:

<ul>
  <li><a href="/categories/">Top</a>
  <ul>
    <li><a href="/categories/grandparent/">Grandparent</a>
    <ul>
      <li><a href="/categories/grandparent/parent/">Parent</a>
      <ul>
        <li><a href="/categories/grandparent/parent/child1">Child1</a></li>
        <li><a href="/categories/grandparent/parent/child2">Child2</a></li>
        <li><a href="/categories/grandparent/parent/child3">Child3</a></li>
      </ul>
      </li>
    </ul>
    </li>
  </ul>
  </li>
</ul>