浏览代码

Use intersphinx to link to treebeard docs

Sage Abdullah 4 月之前
父节点
当前提交
f54b03d595
共有 4 个文件被更改,包括 8 次插入4 次删除
  1. 1 1
      docs/advanced_topics/testing.md
  2. 4 0
      docs/conf.py
  3. 1 1
      docs/reference/models.md
  4. 2 2
      wagtail/models/__init__.py

+ 1 - 1
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.

+ 4 - 0
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,

+ 1 - 1
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}

+ 2 - 2
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() <https://django-treebeard.readthedocs.io/en/latest/mp_tree.html#treebeard.mp_tree.MP_Node.add_child>`_
-        or `add_sibling() <https://django-treebeard.readthedocs.io/en/latest/mp_tree.html#treebeard.mp_tree.MP_Node.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.