File: ns_tree.rst

package info (click to toggle)
python-django-treebeard 2.0~beta1-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 584 kB
  • ctags: 624
  • sloc: python: 4,037; makefile: 92
file content (54 lines) | stat: -rw-r--r-- 1,210 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Nested Sets trees
=================

.. module:: treebeard.ns_tree

An implementation of Nested Sets trees for Django 1.4+, as described by
`Joe Celko`_ in `Trees and Hierarchies in SQL for Smarties`_.

Nested sets have very efficient reads at the cost of high maintenance on
write/delete operations.


.. _`Joe Celko`: http://en.wikipedia.org/wiki/Joe_Celko
.. _`Trees and Hierarchies in SQL for Smarties`:
  http://www.elsevier.com/wps/product/cws_home/702605

.. inheritance-diagram:: NS_Node
.. autoclass:: NS_Node
  :show-inheritance:


  .. attribute:: node_order_by

     Attribute: a list of model fields that will be used for node
     ordering. When enabled, all tree operations will assume this ordering.

     Example::

        node_order_by = ['field1', 'field2', 'field3']

  .. attribute:: depth

     ``PositiveIntegerField``, depth of a node in the tree. A root node
     has a depth of *1*.

  .. attribute:: lft

     ``PositiveIntegerField``

  .. attribute:: rgt

     ``PositiveIntegerField``

  .. attribute:: tree_id

     ``PositiveIntegerField``

  .. automethod:: get_tree

        See: :meth:`treebeard.Node.get_tree`

        .. note::

            This metod returns a queryset.