Skip to content

Commit

Permalink
Finished the doc refactoring and generated the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey Oordt committed May 28, 2010
1 parent 3e6944d commit 908db01
Show file tree
Hide file tree
Showing 22 changed files with 2,129 additions and 6 deletions.
5 changes: 3 additions & 2 deletions doc_src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
DESTDIR = ..

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
Expand All @@ -31,9 +32,9 @@ clean:
-rm -rf $(BUILDDIR)/*

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DESTDIR)/docs
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
@echo "Build finished. The HTML pages are in $(DESTDIR)/docs."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
Expand Down
11 changes: 7 additions & 4 deletions doc_src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.append(os.path.abspath('.'))
sys.path.append(os.path.abspath('..'))
os.environ['DJANGO_SETTINGS_MODULE'] = 'example.settings'

import categories

# -- General configuration -----------------------------------------------------

Expand All @@ -38,16 +41,16 @@

# General information about the project.
project = u'Django Categories'
copyright = u'2009, CoreyOordt'
copyright = u'2010, CoreyOordt'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.2'
version = categories.get_version()
# The full version, including alpha/beta/rc tags.
release = '0.2'
release = categories.get_version()

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
4 changes: 4 additions & 0 deletions docs/.buildinfo
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
23 changes: 23 additions & 0 deletions docs/_sources/index.txt
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`

26 changes: 26 additions & 0 deletions docs/_sources/registering_models.txt
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.


74 changes: 74 additions & 0 deletions docs/_sources/usage.txt
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']

0 comments on commit 908db01

Please sign in to comment.