-
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finished the doc refactoring and generated the docs
- Loading branch information
Corey Oordt
committed
May 28, 2010
1 parent
3e6944d
commit 908db01
Showing
22 changed files
with
2,129 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 35a7e455d406e3078835766fcefa9955 | ||
tags: fbb0d17656682115ca4d033fb2f83ba1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.. Django Categories documentation master file, created by | ||
sphinx-quickstart on Tue Oct 6 07:53:33 2009. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
|
||
Welcome to Django Categories's documentation! | ||
============================================= | ||
|
||
Contents: | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:glob: | ||
|
||
usage | ||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
================== | ||
Registering Models | ||
================== | ||
|
||
|
||
|
||
|
||
You can register models with the | ||
|
||
import categories | ||
categories.register_fk(MyModel) | ||
|
||
or | ||
|
||
import categories | ||
categories.register_m2m(MyModel) | ||
|
||
If you want more than one field on a model you have to have some extra arguments | ||
|
||
import categories | ||
categories.register_fk(MyModel, 'primary_category') | ||
categories.register_fk(MyModel, 'secondary_category', {'related_name':'mymodel_sec_set'}) | ||
|
||
The ``extra_args`` allows you to specify the related_name of one of the fields so it doesn't clash. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
Ways to use the categories app | ||
============================== | ||
|
||
The categories app is a generalized storage mechanism for hierarchical data. You can use it in two ways: | ||
|
||
1. As storage for one tree of categories, e.g.:: | ||
|
||
Top Category 1 | ||
Subcategory 1-1 | ||
Subcategory 1-2 | ||
subcategory 1-2-1 | ||
Top Category 2 | ||
Subcategory 2-1 | ||
|
||
2. As a storage of several trees of categories, e.g.:: | ||
|
||
Model 1 | ||
Top Category 1 | ||
Subcategory 1-1 | ||
Subcategory 1-2 | ||
subcategory 1-2-1 | ||
Top Category 2 | ||
Subcategory 2-1 | ||
Model 2 | ||
Super Category 1 | ||
Super Subcategory 1-1 | ||
Super Subcategory 1-2 | ||
super subcategory 1-2-1 | ||
Super Category 2 | ||
Super Subcategory 2-1 | ||
|
||
Using categories in templates | ||
============================= | ||
|
||
To use the template tags::: | ||
|
||
{% import category_tags %} | ||
|
||
Filters | ||
******* | ||
|
||
``tree_info`` | ||
------------- | ||
|
||
Given a list of categories, iterates over the list, generating | ||
two-tuples of the current tree item and a ``dict`` containing | ||
information about the tree structure around the item, with the following | ||
keys: | ||
|
||
``'new_level'`` | ||
``True`` if the current item is the start of a new level in | ||
the tree, ``False`` otherwise. | ||
|
||
``'closed_levels'`` | ||
A list of levels which end after the current item. This will | ||
be an empty list if the next item's level is the same as or | ||
greater than the level of the current item. | ||
|
||
An optional argument can be provided to specify extra details about the | ||
structure which should appear in the ``dict``. This should be a | ||
comma-separated list of feature names. The valid feature names are: | ||
|
||
ancestors | ||
Adds a list of unicode representations of the ancestors of the | ||
current node, in descending order (root node first, immediate | ||
parent last), under the key ``'ancestors'``. | ||
|
||
For example: given the sample tree below, the contents of the list | ||
which would be available under the ``'ancestors'`` key are given | ||
on the right:: | ||
|
||
Books -> [] | ||
Sci-fi -> [u'Books'] | ||
Dystopian Futures -> [u'Books', u'Sci-fi'] |
Oops, something went wrong.