diff --git a/docs/advanced_topics/testing.md b/docs/advanced_topics/testing.md index 8ea6eb3192..dc1655a0f5 100644 --- a/docs/advanced_topics/testing.md +++ b/docs/advanced_topics/testing.md @@ -329,4 +329,4 @@ You could create such a homepage in a fixture with: Filling in the `path` / `numchild` / `depth` fields is necessary for tree operations like `get_parent()` to work correctly. `url_path` is another field that can cause errors in some uncommon cases if it isn't filled in. -The [Treebeard docs](https://django-treebeard.readthedocs.io/en/latest/mp_tree.html) might help in understanding how this works. +The [Treebeard docs](inv:treebeard:std:doc#mp_tree) might help in understanding how this works. diff --git a/docs/conf.py b/docs/conf.py index d87b419b8f..e227e870c5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -173,6 +173,10 @@ intersphinx_mapping = { "https://docs.python.org/3/", None, ), + "treebeard": ( + "https://django-treebeard.readthedocs.io/en/stable/", + None, + ), "sphinx": ( "https://www.sphinx-doc.org/en/master/", None, diff --git a/docs/reference/models.md b/docs/reference/models.md index 834daa2d1d..a85b0474af 100644 --- a/docs/reference/models.md +++ b/docs/reference/models.md @@ -151,7 +151,7 @@ This document contains reference information for the model classes inside the `w In addition to the model fields provided, `Page` has many properties and methods that you may wish to reference, use, or override in creating your own models. ```{note} -See also [django-treebeard](https://django-treebeard.readthedocs.io/en/latest/index.html)'s [node API](https://django-treebeard.readthedocs.io/en/latest/api.html). ``Page`` is a subclass of [materialized path tree](https://django-treebeard.readthedocs.io/en/latest/mp_tree.html) nodes. +See also [django-treebeard](inv:treebeard:std:doc#index)'s [node API](inv:treebeard:std:doc#api). ``Page`` is a subclass of [materialized path tree](inv:treebeard:std:doc#mp_tree) nodes. ``` ```{eval-rst} diff --git a/wagtail/models/__init__.py b/wagtail/models/__init__.py index 8fd405ada8..114766e079 100644 --- a/wagtail/models/__init__.py +++ b/wagtail/models/__init__.py @@ -1590,8 +1590,8 @@ class Page(AbstractPage, index.Indexed, ClusterableModel, metaclass=PageBase): such as updating the ``url_path`` value of descendant page to reflect changes to this page's slug. - New pages should generally be saved via the `add_child() `_ - or `add_sibling() `_ + New pages should generally be saved via the :meth:`~treebeard.mp_tree.MP_Node.add_child` + or :meth:`~treebeard.mp_tree.MP_Node.add_sibling` method of an existing page, which will correctly set the ``path`` and ``depth`` fields on the new page before saving it.