Browse Source

Replace more hardcoded Django links with intersphinx in rST docs

Some link labels are changed to just the code part, because using Sphinx
roles for code objects (e.g. methods, attributes) would always format the
text as inline code.

It's currently impossible to customize the formatting of a link's text in
rST. See https://stackoverflow.com/questions/4743845
Sage Abdullah 4 tháng trước cách đây
mục cha
commit
9a5be8f180

+ 1 - 1
docs/contributing/translations.md

@@ -100,7 +100,7 @@ You can import `i18n` and then translate with the `translate`/`blocktranslate` t
 ```
 
 **Note**: In Wagtail code, you might see `trans` and `blocktrans` instead of `translate` and `blocktranslate`.
-This still works fine. `trans` and `blocktrans` were the tags earlier on in Django, but [were replaced in Django 3.1](https://docs.djangoproject.com/en/5.1/releases/3.1/#templates).
+This still works fine. `trans` and `blocktrans` were the tags earlier on in Django, but [were replaced in Django 3.1](https://docs.djangoproject.com/en/stable/releases/3.1/#templates).
 
 ## Additional resources
 

+ 18 - 18
docs/reference/streamfield/blocks.md

@@ -68,7 +68,7 @@ All block definitions accept the following optional keyword arguments:
     :param min_length: The minimum allowed length of the field.
     :param help_text: Help text to display alongside the field.
     :param search_index: If false (default true), the content of this block will not be indexed for searching.
-    :param validators: A list of validation functions for the field (see `Django Validators <https://docs.djangoproject.com/en/stable/ref/validators/>`__).
+    :param validators: A list of validation functions for the field (see :doc:`Django Validators <django:ref/validators>`).
     :param form_classname: A value to add to the form field's ``class`` attribute when rendered on the page editing form.
 
 
@@ -83,7 +83,7 @@ All block definitions accept the following optional keyword arguments:
     :param help_text: Help text to display alongside the field.
     :param search_index: If false (default true), the content of this block will not be indexed for searching.
     :param rows: Number of rows to show on the textarea (defaults to 1).
-    :param validators: A list of validation functions for the field (see `Django Validators <https://docs.djangoproject.com/en/stable/ref/validators/>`__).
+    :param validators: A list of validation functions for the field (see :doc:`Django Validators <django:ref/validators>`).
     :param form_classname: A value to add to the form field's ``class`` attribute when rendered on the page editing form.
 
 
@@ -94,7 +94,7 @@ All block definitions accept the following optional keyword arguments:
 
     :param required: If true (the default), the field cannot be left blank.
     :param help_text: Help text to display alongside the field.
-    :param validators: A list of validation functions for the field (see `Django Validators <https://docs.djangoproject.com/en/stable/ref/validators/>`__).
+    :param validators: A list of validation functions for the field (see :doc:`Django Validators <django:ref/validators>`).
     :param form_classname: A value to add to the form field's ``class`` attribute when rendered on the page editing form.
 
 
@@ -107,7 +107,7 @@ All block definitions accept the following optional keyword arguments:
     :param max_value: The maximum allowed numeric value of the field.
     :param min_value: The minimum allowed numeric value of the field.
     :param help_text: Help text to display alongside the field.
-    :param validators: A list of validation functions for the field (see `Django Validators <https://docs.djangoproject.com/en/stable/ref/validators/>`__).
+    :param validators: A list of validation functions for the field (see :doc:`Django Validators <django:ref/validators>`).
     :param form_classname: A value to add to the form field's ``class`` attribute when rendered on the page editing form.
 
 
@@ -119,7 +119,7 @@ All block definitions accept the following optional keyword arguments:
     :param required: If true (the default), the field cannot be left blank.
     :param max_value: The maximum allowed numeric value of the field.
     :param min_value: The minimum allowed numeric value of the field.
-    :param validators: A list of validation functions for the field (see `Django Validators <https://docs.djangoproject.com/en/stable/ref/validators/>`__).
+    :param validators: A list of validation functions for the field (see :doc:`Django Validators <django:ref/validators>`).
     :param form_classname: A value to add to the form field's ``class`` attribute when rendered on the page editing form.
 
 
@@ -134,7 +134,7 @@ All block definitions accept the following optional keyword arguments:
     :param min_value: The minimum allowed numeric value of the field.
     :param max_digits: The maximum number of digits allowed in the number. This number must be greater than or equal to ``decimal_places``.
     :param decimal_places: The number of decimal places to store with the number.
-    :param validators: A list of validation functions for the field (see `Django Validators <https://docs.djangoproject.com/en/stable/ref/validators/>`__).
+    :param validators: A list of validation functions for the field (see :doc:`Django Validators <django:ref/validators>`).
     :param form_classname: A value to add to the form field's ``class`` attribute when rendered on the page editing form.
 
 
@@ -157,7 +157,7 @@ All block definitions accept the following optional keyword arguments:
     :param help_text: Help text to display alongside the field.
     :param max_length: The maximum allowed length of the field.
     :param min_length: The minimum allowed length of the field.
-    :param validators: A list of validation functions for the field (see `Django Validators <https://docs.djangoproject.com/en/stable/ref/validators/>`__).
+    :param validators: A list of validation functions for the field (see :doc:`Django Validators <django:ref/validators>`).
     :param form_classname: A value to add to the form field's ``class`` attribute when rendered on the page editing form.
 
 
@@ -170,7 +170,7 @@ All block definitions accept the following optional keyword arguments:
     :param max_length: The maximum allowed length of the field.
     :param min_length: The minimum allowed length of the field.
     :param help_text: Help text to display alongside the field.
-    :param validators: A list of validation functions for the field (see `Django Validators <https://docs.djangoproject.com/en/stable/ref/validators/>`__).
+    :param validators: A list of validation functions for the field (see :doc:`Django Validators <django:ref/validators>`).
     :param form_classname: A value to add to the form field's ``class`` attribute when rendered on the page editing form.
 
 
@@ -192,7 +192,7 @@ All block definitions accept the following optional keyword arguments:
     :param format: Date format. This must be one of the recognized formats listed in the `DATE_INPUT_FORMATS <https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-DATE_INPUT_FORMATS>`_ setting. If not specified Wagtail will use the ``WAGTAIL_DATE_FORMAT`` setting with fallback to '%Y-%m-%d'.
     :param required: If true (the default), the field cannot be left blank.
     :param help_text: Help text to display alongside the field.
-    :param validators: A list of validation functions for the field (see `Django Validators <https://docs.djangoproject.com/en/stable/ref/validators/>`__).
+    :param validators: A list of validation functions for the field (see :doc:`Django Validators <django:ref/validators>`).
     :param form_classname: A value to add to the form field's ``class`` attribute when rendered on the page editing form.
 
 
@@ -203,7 +203,7 @@ All block definitions accept the following optional keyword arguments:
 
     :param required: If true (the default), the field cannot be left blank.
     :param help_text: Help text to display alongside the field.
-    :param validators: A list of validation functions for the field (see `Django Validators <https://docs.djangoproject.com/en/stable/ref/validators/>`__).
+    :param validators: A list of validation functions for the field (see :doc:`Django Validators <django:ref/validators>`).
     :param form_classname: A value to add to the form field's ``class`` attribute when rendered on the page editing form.
 
 
@@ -215,7 +215,7 @@ All block definitions accept the following optional keyword arguments:
     :param format: Date/time format. This must be one of the recognized formats listed in the `DATETIME_INPUT_FORMATS <https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-DATETIME_INPUT_FORMATS>`_ setting. If not specified Wagtail will use the ``WAGTAIL_DATETIME_FORMAT`` setting with fallback to '%Y-%m-%d %H:%M'.
     :param required: If true (the default), the field cannot be left blank.
     :param help_text: Help text to display alongside the field.
-    :param validators: A list of validation functions for the field (see `Django Validators <https://docs.djangoproject.com/en/stable/ref/validators/>`__).
+    :param validators: A list of validation functions for the field (see :doc:`Django Validators <django:ref/validators>`).
     :param form_classname: A value to add to the form field's ``class`` attribute when rendered on the page editing form.
 
 
@@ -230,7 +230,7 @@ All block definitions accept the following optional keyword arguments:
     :param max_length: The maximum allowed length of the field. Only text is counted; rich text formatting, embedded content and paragraph / line breaks do not count towards the limit.
     :param search_index: If false (default true), the content of this block will not be indexed for searching.
     :param help_text: Help text to display alongside the field.
-    :param validators: A list of validation functions for the field (see `Django Validators <https://docs.djangoproject.com/en/stable/ref/validators/>`__).
+    :param validators: A list of validation functions for the field (see :doc:`Django Validators <django:ref/validators>`).
     :param form_classname: A value to add to the form field's ``class`` attribute when rendered on the page editing form.
 
 
@@ -243,7 +243,7 @@ All block definitions accept the following optional keyword arguments:
     :param max_length: The maximum allowed length of the field.
     :param min_length: The minimum allowed length of the field.
     :param help_text: Help text to display alongside the field.
-    :param validators: A list of validation functions for the field (see `Django Validators <https://docs.djangoproject.com/en/stable/ref/validators/>`__).
+    :param validators: A list of validation functions for the field (see :doc:`Django Validators <django:ref/validators>`).
     :param form_classname: A value to add to the form field's ``class`` attribute when rendered on the page editing form.
 
     .. WARNING::
@@ -259,7 +259,7 @@ All block definitions accept the following optional keyword arguments:
     :param max_length: The maximum allowed length of the field.
     :param min_length: The minimum allowed length of the field.
     :param help_text: Help text to display alongside the field.
-    :param validators: A list of validation functions for the field (see `Django Validators <https://docs.djangoproject.com/en/stable/ref/validators/>`__).
+    :param validators: A list of validation functions for the field (see :doc:`Django Validators <django:ref/validators>`).
     :param form_classname: A value to add to the form field's ``class`` attribute when rendered on the page editing form.
 
 
@@ -272,8 +272,8 @@ All block definitions accept the following optional keyword arguments:
     :param required: If true (the default), the field cannot be left blank.
     :param help_text: Help text to display alongside the field.
     :param search_index: If false (default true), the content of this block will not be indexed for searching.
-    :param widget: The form widget to render the field with (see `Django Widgets <https://docs.djangoproject.com/en/stable/ref/forms/widgets/>`__).
-    :param validators: A list of validation functions for the field (see `Django Validators <https://docs.djangoproject.com/en/stable/ref/validators/>`__).
+    :param widget: The form widget to render the field with (see :doc:`Django Widgets <django:ref/forms/widgets>`).
+    :param validators: A list of validation functions for the field (see :doc:`Django Validators <django:ref/validators>`).
     :param form_classname: A value to add to the form field's ``class`` attribute when rendered on the page editing form.
 
     ``ChoiceBlock`` can also be subclassed to produce a reusable block with the same list of choices everywhere it is used. For example, a block definition such as:
@@ -317,8 +317,8 @@ All block definitions accept the following optional keyword arguments:
     :param required: If true (the default), the field cannot be left blank.
     :param help_text: Help text to display alongside the field.
     :param search_index: If false (default true), the content of this block will not be indexed for searching.
-    :param widget: The form widget to render the field with (see `Django Widgets <https://docs.djangoproject.com/en/stable/ref/forms/widgets/>`__).
-    :param validators: A list of validation functions for the field (see `Django Validators <https://docs.djangoproject.com/en/stable/ref/validators/>`__).
+    :param widget: The form widget to render the field with (see :doc:`Django Widgets <django:ref/forms/widgets>`).
+    :param validators: A list of validation functions for the field (see :doc:`Django Validators <django:ref/validators>`).
     :param form_classname: A value to add to the form field's ``class`` attribute when rendered on the page editing form.
 
 

+ 1 - 1
docs/releases/1.10.rst

@@ -159,7 +159,7 @@ Projects using :ref:`custom image models <custom_image_model>` no longer need to
 Adding / editing users through Wagtail admin no longer sets ``is_staff`` flag
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Previously, the ``is_staff`` flag (which grants access to the Django admin interface) was automatically set for superusers, and reset for other users, when creating and updating users through the Wagtail admin. This behaviour has now been removed, since Wagtail is designed to work independently of the Django admin. If you need to reinstate the old behavior, you can set up a `pre_save signal handler <https://docs.djangoproject.com/en/stable/ref/signals/#django.db.models.signals.pre_save>`_ on the User model to set the flag appropriately.
+Previously, the ``is_staff`` flag (which grants access to the Django admin interface) was automatically set for superusers, and reset for other users, when creating and updating users through the Wagtail admin. This behaviour has now been removed, since Wagtail is designed to work independently of the Django admin. If you need to reinstate the old behavior, you can set up a :py:data:`~django.db.models.signals.pre_save` signal handler on the User model to set the flag appropriately.
 
 
 Specifying the full file name in documents URL is mandatory

+ 1 - 1
docs/releases/2.7.4.rst

@@ -7,7 +7,7 @@ Wagtail 2.7.4 release notes
 CVE-2020-15118: HTML injection through form field help text
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-This release addresses an HTML injection vulnerability through help text in the ``wagtail.contrib.forms`` form builder app. When a form page type is made available to Wagtail editors, and the page template is built using Django's standard form rendering helpers such as ``form.as_p`` :ref:`(as directed in the documentation) <form_builder_usage>`, any HTML tags used within a form field's help text will be rendered unescaped in the page. Allowing HTML within help text is `an intentional design decision by Django <https://docs.djangoproject.com/en/3.0/ref/models/fields/#django.db.models.Field.help_text>`_; however, as a matter of policy Wagtail does not allow editors to insert arbitrary HTML by default, as this could potentially be used to carry out cross-site scripting attacks, including privilege escalation. This functionality should therefore not have been made available to editor-level users.
+This release addresses an HTML injection vulnerability through help text in the ``wagtail.contrib.forms`` form builder app. When a form page type is made available to Wagtail editors, and the page template is built using Django's standard form rendering helpers such as ``form.as_p`` :ref:`(as directed in the documentation) <form_builder_usage>`, any HTML tags used within a form field's help text will be rendered unescaped in the page. Allowing HTML within help text is an intentional design decision by Django (see the docs for :py:attr:`~django.db.models.Field.help_text`); however, as a matter of policy Wagtail does not allow editors to insert arbitrary HTML by default, as this could potentially be used to carry out cross-site scripting attacks, including privilege escalation. This functionality should therefore not have been made available to editor-level users.
 
 The vulnerability is not exploitable by an ordinary site visitor without access to the Wagtail admin.
 

+ 1 - 1
docs/releases/2.8.rst

@@ -141,7 +141,7 @@ The ``get_document_model`` function should now be imported from ``wagtail.docume
 Removed ``Page`` and ``Site`` models from Django admin
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-The ``Page`` and ``Site`` models are no longer editable through the Django admin backend. If required these models can be re-registered within your own project using `Django's ModelAdmin <https://docs.djangoproject.com/en/2.2/ref/contrib/admin/#modeladmin-objects>`_:
+The ``Page`` and ``Site`` models are no longer editable through the Django admin backend. If required these models can be re-registered within your own project using Django's :py:class:`~django.contrib.admin.ModelAdmin`:
 
 
 .. code-block:: python

+ 1 - 1
docs/releases/2.9.3.rst

@@ -7,7 +7,7 @@ Wagtail 2.9.3 release notes
 CVE-2020-15118: HTML injection through form field help text
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-This release addresses an HTML injection vulnerability through help text in the ``wagtail.contrib.forms`` form builder app. When a form page type is made available to Wagtail editors, and the page template is built using Django's standard form rendering helpers such as ``form.as_p`` :ref:`(as directed in the documentation) <form_builder_usage>`, any HTML tags used within a form field's help text will be rendered unescaped in the page. Allowing HTML within help text is `an intentional design decision by Django <https://docs.djangoproject.com/en/3.0/ref/models/fields/#django.db.models.Field.help_text>`_; however, as a matter of policy Wagtail does not allow editors to insert arbitrary HTML by default, as this could potentially be used to carry out cross-site scripting attacks, including privilege escalation. This functionality should therefore not have been made available to editor-level users.
+This release addresses an HTML injection vulnerability through help text in the ``wagtail.contrib.forms`` form builder app. When a form page type is made available to Wagtail editors, and the page template is built using Django's standard form rendering helpers such as ``form.as_p`` :ref:`(as directed in the documentation) <form_builder_usage>`, any HTML tags used within a form field's help text will be rendered unescaped in the page. Allowing HTML within help text is an intentional design decision by Django (see the docs for :py:attr:`~django.db.models.Field.help_text`); however, as a matter of policy Wagtail does not allow editors to insert arbitrary HTML by default, as this could potentially be used to carry out cross-site scripting attacks, including privilege escalation. This functionality should therefore not have been made available to editor-level users.
 
 The vulnerability is not exploitable by an ordinary site visitor without access to the Wagtail admin.
 

+ 1 - 1
docs/releases/2.9.rst

@@ -131,4 +131,4 @@ Once these are removed, ``'wagtail.core.middleware.SiteMiddleware'`` can be remo
 Page / Collection managers no longer expose a ``delete`` method
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-For `consistency with standard Django models <https://docs.djangoproject.com/en/stable/topics/db/queries/#deleting-objects>`_, the ``delete()`` method is no longer available on the default Page and Collection managers. Code such as ``Page.objects.delete()`` should be changed to ``Page.objects.all().delete()``.
+For :ref:`consistency with standard Django models <django:ref/models/instances:deleting objects>`, the ``delete()`` method is no longer available on the default Page and Collection managers. Code such as ``Page.objects.delete()`` should be changed to ``Page.objects.all().delete()``.