Skip to content

Commit

Permalink
Fix #76: Add some docs for the .tree_names() field
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Sep 3, 2024
1 parent 9b3af54 commit d02c16c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,22 @@ If you only want nodes from the top two levels:
)
Aggregating ancestor fields
---------------------------

It may be useful to aggregate fields from ancestor nodes, e.g. to collect parts
of a path or something similar.

.. code-block:: python
nodes = Node.objects.with_tree_fields().tree_fields(
tree_names="name",
)
All nodes will now have a ``tree_names`` attribute containing a list of all
ancestors' names, including the node itself.


Form fields
~~~~~~~~~~~

Expand Down

0 comments on commit d02c16c

Please sign in to comment.