Browse Source

fixes errors by adding aliases, double backtick, changing indexentry

Himanshu Garg 9 months ago
parent
commit
9adf742580

+ 3 - 3
docs/advanced_topics/images/custom_image_model.md

@@ -76,15 +76,15 @@ The following methods can be overridden on your custom `Image` or `Rendition` mo
 
 ```{eval-rst}
 .. automodule:: wagtail.images.models
-    :noindex:
+    :no-index:
 
 .. class:: AbstractImage
-    :noindex:
+    :noindexentry:
 
     .. automethod:: get_upload_to
 
 .. class:: AbstractRendition
-    :noindex:
+    :noindexentry:
 
     .. automethod:: get_upload_to
 ```

+ 1 - 1
docs/advanced_topics/images/renditions.md

@@ -157,7 +157,7 @@ The following `AbstractImage` model methods are involved in finding and generati
 .. automodule:: wagtail.images.models
 
 .. class:: AbstractImage
-    :noindex:
+    :no-index:
 
     .. automethod:: get_rendition
 

+ 4 - 1
docs/conf.py

@@ -35,7 +35,6 @@ html_theme_options = {
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
 sys.path.insert(0, os.path.abspath(".."))
-sys.path.insert(0, os.path.abspath("../i18n.py"))
 
 # Autodoc may need to import some models modules which require django settings
 # be configured
@@ -61,6 +60,10 @@ extensions = [
     "sphinx_wagtail_theme",
 ]
 
+autodoc_type_aliases = {
+    "File": "django.core.files.File",
+}
+
 if not on_rtd:
     extensions.append("sphinxcontrib.spelling")
 

+ 3 - 4
docs/reference/pages/model_reference.md

@@ -486,7 +486,6 @@ database queries making them unable to be edited or viewed.
 
 ```{eval-rst}
 .. class:: Locale
-    :noindex:
 
     .. autoattribute:: language_code
 
@@ -521,7 +520,7 @@ Pages already include this mixin, so there is no need to add it.
 
     .. attribute:: locale
 
-        (Foreign Key to `~wagtail.models.Locale`)
+        (Foreign Key to :class:`wagtail.models.Locale`)
 
         For pages, this defaults to the locale of the parent page.
 
@@ -808,7 +807,7 @@ You can use the [`purge_revisions`](purge_revisions) command to delete old revis
 
     .. attribute:: objects
 
-        This default manager is used to retrieve all of the ``Revision`` objects in the database. It also provides a `~wagtail.models.RevisionsManager.for_instance` method that lets you query for revisions of a specific object.
+        This default manager is used to retrieve all of the ``Revision`` objects in the database. It also provides a ``wagtail.models.RevisionsManager.for_instance`` method that lets you query for revisions of a specific object.
 
         Example:
 
@@ -1280,7 +1279,7 @@ An abstract base class that represents a record of an action performed on an obj
 
         The object title at the time of the entry creation
 
-        Note: Wagtail will attempt to use ``get_admin_display_title`` or the string representation of the object passed to `~LogEntryManger.log_action`
+        Note: Wagtail will attempt to use ``get_admin_display_title`` or the string representation of the object passed to ``LogEntryManger.log_action``
 
     .. attribute:: user
 

+ 1 - 1
docs/reference/pages/panels.md

@@ -280,7 +280,7 @@ The `MultipleChooserPanel` definition on `BlogPage` would be:
 
 .. class:: FormSubmissionsPanel(**kwargs)
 
-    This panel adds a single, read-only section in the edit interface for pages implementing the `~wagtail.contrib.forms.models.AbstractForm` model.
+    This panel adds a single, read-only section in the edit interface for pages implementing the ``wagtail.contrib.forms.models.AbstractForm`` model.
     It includes the number of total submissions for the given form and also a link to the listing of submissions.
 
     .. code-block:: python

+ 2 - 2
docs/releases/1.11.rst

@@ -121,8 +121,8 @@ to:
 
 and passing those through at the point where you are calling ``get_url_parts`` on ``super`` (if applicable).
 
-See also: `wagtail.core.models.Page.get_url_parts`, `wagtail.core.models.Page.get_url`,
-`wagtail.core.models.Page.get_full_url`, and `wagtail.core.models.Page.relative_url`
+See also: :meth:`wagtail.models.Page.get_url_parts`, :meth:`wagtail.models.Page.get_url`,
+:meth:`wagtail.models.Page.get_full_url`, and :meth:`wagtail.models.Page.relative_url`
 
 
 "Password required" template for documents

+ 1 - 1
docs/releases/1.2.rst

@@ -115,7 +115,7 @@ Bug fixes
 * Dropdown for ``ForeignKey`` s are now styled consistently (Ashia Zawaduk)
 * Date choosers now appear on top of StreamField menus (Sergey Nikitin)
 * Fixed a migration error that was raised when block-updating from 0.8 to 1.1+
-* `Page.copy() <wagtail.core.models.Page.copy>` no longer breaks on models with a ``ClusterTaggableManager`` or ``ManyToManyField``
+* :meth:`wagtail.models.Page.copy() <wagtail.models.Page.copy>` no longer breaks on models with a ``ClusterTaggableManager`` or ``ManyToManyField``
 * Validation errors when inserting an embed into a rich text area are now reported back to the editor
 
 Upgrade considerations

+ 1 - 2
docs/releases/1.6.1.rst

@@ -22,8 +22,7 @@ Bug fixes
 ~~~~~~~~~
 
 * Wagtail's middleware classes are now compatible with Django 1.10's `new-style middleware <https://docs.djangoproject.com/en/stable/releases/1.10/#new-style-middleware>`_ (Karl Hobley)
-* The `~wagtail.core.models.Page.can_create_at` method is now checked in the create page view (Mikalai Radchuk)
-* Fixed regression on Django 1.10.1 causing Page subclasses to fail to use PageManager (Matt Westcott)
+* The :meth:`~wagtail.models.Page.can_create_at` method is now checked in the create page view (Mikalai Radchuk)* Fixed regression on Django 1.10.1 causing Page subclasses to fail to use PageManager (Matt Westcott)
 * ChoiceBlocks with lazy translations as option labels no longer break Elasticsearch indexing (Matt Westcott)
 * The page editor no longer fails to load JavaScript files with ``ManifestStaticFilesStorage`` (Matt Westcott)
 * Django 1.10 enables client-side validation for all forms by default, but it fails to handle all the nuances of how forms are used in Wagtail. The client-side validation has been disabled for the Wagtail UI (Matt Westcott)

+ 1 - 2
docs/releases/1.8.rst

@@ -70,8 +70,7 @@ Other features
 * ``ChoiceBlock`` now accepts a callable as the choices list (Mikalai Radchuk)
 * Redundant action buttons are now omitted from the root page in the explorer (Nick Smith)
 * Locked pages are now disabled from editing at the browser level (Edd Baldry)
-* Added `wagtail.core.query.PageQuerySet.in_site` method for filtering page QuerySets to pages within the specified site (Chris Rogers)
-* Added the ability to override the default index settings for Elasticsearch. See :ref:`wagtailsearch_backends_elasticsearch` (PyMan Claudio Marinozzi)
+* Added :meth:`wagtail.query.PageQuerySet.in_site` method for filtering page QuerySets to pages within the specified site (Chris Rogers)* Added the ability to override the default index settings for Elasticsearch. See :ref:`wagtailsearch_backends_elasticsearch` (PyMan Claudio Marinozzi)
 * Extra options for the Elasticsearch constructor should be now defined with the new key ``OPTIONS`` of the ``WAGTAILSEARCH_BACKENDS`` setting (PyMan Claudio Marinozzi)
 
 

+ 3 - 3
docs/releases/5.2.md

@@ -63,7 +63,7 @@ Thank you to core contributor LB (Ben) Johnston for writing this documentation.
 
 ### `ModelViewSet` improvements
 
-Several features from `~wagtail.snippets.views.snippets.SnippetViewSet` have been implemented in `~wagtail.admin.viewsets.model.ModelViewSet`, allowing you to use them without registering your models as snippets. For more details on using `ModelViewSet`, refer to [](generic_views).
+Several features from {class}`~wagtail.snippets.views.snippets.SnippetViewSet` have been implemented in {class}`~wagtail.admin.viewsets.model.ModelViewSet`, allowing you to use them without registering your models as snippets. For more details on using `ModelViewSet`, refer to [](generic_views).
 
  * Move `SnippetViewSet` menu registration mechanism to base `ViewSet` class (Sage Abdullah)
  * Move `SnippetViewSet` template override mechanism to `ModelViewSet` (Sage Abdullah)
@@ -300,7 +300,7 @@ def register_frank_menu_item():
 
 ### Edit and delete URLs in `ModelViewSet` changed to allow non-integer primary keys
 
-To accommodate models with non-integer primary keys, the URL patterns for the edit and delete views in `~wagtail.admin.viewsets.model.ModelViewSet` have been changed.
+To accommodate models with non-integer primary keys, the URL patterns for the edit and delete views in {class}`~wagtail.admin.viewsets.model.ModelViewSet` have been changed.
 
 Relative to the viewset's {attr}`~wagtail.admin.viewsets.base.ViewSet.url_prefix`, the following changes have been made:
 - The edit URL pattern has been changed from `<int:pk>/` to `edit/<str:pk>/`
@@ -310,7 +310,7 @@ If you use {func}`~django.urls.reverse` with {meth}`~wagtail.admin.viewsets.base
 
 Redirects for the legacy URLs are in place for backwards compatibility, but will be removed in a future release.
 
-The URLs for snippets underwent similar changes in Wagtail 2.14. The redirects for the legacy URLs in `~wagtail.snippets.views.snippets.SnippetViewSet` have now been marked for removal in a future release.
+The URLs for snippets underwent similar changes in Wagtail 2.14. The redirects for the legacy URLs in {class}`~wagtail.snippets.views.snippets.SnippetViewSet` have now been marked for removal in a future release.
 
 ### `ModelViewSet` automatically registers the model to the reference index
 

+ 1 - 1
wagtail/documents/__init__.py

@@ -14,7 +14,7 @@ def get_document_model_string():
 def get_document_model():
     """
     Get the document model from the ``WAGTAILDOCS_DOCUMENT_MODEL`` setting.
-    Defaults to the standard `~wagtail.documents.models.Document` model
+    Defaults to the standard ``wagtail.documents.models.Document`` model
     if no custom model is defined.
     """
     from django.apps import apps

+ 1 - 1
wagtail/images/__init__.py

@@ -15,7 +15,7 @@ def get_image_model():
     """
     Get the image model from the ``WAGTAILIMAGES_IMAGE_MODEL`` setting.
     Useful for developers making Wagtail plugins that need the image model.
-    Defaults to the standard `~wagtail.images.models.Image` model
+    Defaults to the standard ``wagtail.images.models.Image`` model
     if no custom model is defined.
     """
     from django.apps import apps

+ 2 - 0
wagtail/images/models.py

@@ -1,3 +1,5 @@
+from __future__ import annotations
+
 import concurrent.futures
 import hashlib
 import itertools

+ 1 - 1
wagtail/models/__init__.py

@@ -1820,7 +1820,7 @@ class Page(AbstractPage, index.Indexed, ClusterableModel, metaclass=PageBase):
         This is called by Wagtail whenever a page with aliases is published.
 
         :param revision: The revision of the original page that we are updating to (used for logging purposes)
-        :type revision: PageRevision, optional
+        :type revision: Revision, Optional
         """
         specific_self = self.specific
 

+ 1 - 1
wagtail/test/dummy_external_storage.py

@@ -7,7 +7,7 @@
 #  - File.size exceptions raise DummyExternalStorageError
 #  - Storage._save() fails loudly if the content file's pointer is not at the start
 
-from django.core.files.base import File
+from django.core.files import File
 from django.core.files.storage import FileSystemStorage, Storage
 from django.utils.deconstruct import deconstructible