Browse Source

Improve linking between viewset reference and extending docs

Sage Abdullah 1 năm trước cách đây
mục cha
commit
b258b99c86

+ 3 - 1
docs/extending/generic_views.md

@@ -1,10 +1,12 @@
+(generic_views)=
+
 # Generic views
 # Generic views
 
 
 Wagtail provides several generic views for handling common tasks such as creating / editing model instances and chooser modals. Since these often involve several related views with shared properties (such as the model that we're working with, and its associated icon) Wagtail also implements the concept of a _viewset_, which allows a bundle of views to be defined collectively, and their URLs to be registered with the admin app as a single operation through the [`register_admin_viewset`](register_admin_viewset) hook.
 Wagtail provides several generic views for handling common tasks such as creating / editing model instances and chooser modals. Since these often involve several related views with shared properties (such as the model that we're working with, and its associated icon) Wagtail also implements the concept of a _viewset_, which allows a bundle of views to be defined collectively, and their URLs to be registered with the admin app as a single operation through the [`register_admin_viewset`](register_admin_viewset) hook.
 
 
 ## ModelViewSet
 ## ModelViewSet
 
 
-The `wagtail.admin.viewsets.model.ModelViewSet` class provides the views for listing, creating, editing, and deleting model instances. For example, if we have the following model:
+The {class}`wagtail.admin.viewsets.model.ModelViewSet` class provides the views for listing, creating, editing, and deleting model instances. For example, if we have the following model:
 
 
 ```python
 ```python
 from django.db import models
 from django.db import models

+ 1 - 1
docs/reference/viewsets.md

@@ -2,7 +2,7 @@
 
 
 # Viewsets
 # Viewsets
 
 
-Viewsets are Wagtail's mechanism for defining a group of related admin views with shared properties, as a single unit. See [Generic views](../extending/generic_views).
+Viewsets are Wagtail's mechanism for defining a group of related admin views with shared properties, as a single unit.
 
 
 ## ViewSet
 ## ViewSet
 
 

+ 5 - 1
wagtail/admin/viewsets/base.py

@@ -11,8 +11,10 @@ class ViewSet(WagtailMenuRegisterable):
 
 
     All properties of the viewset can be defined as class-level attributes, or passed as
     All properties of the viewset can be defined as class-level attributes, or passed as
     keyword arguments to the constructor (in which case they will override any class-level
     keyword arguments to the constructor (in which case they will override any class-level
-    attributes). Additionally, the `name` property can be passed as the first positional
+    attributes). Additionally, the ``name`` property can be passed as the first positional
     argument to the constructor.
     argument to the constructor.
+
+    For more information on how to use this class, see :ref:`using_base_viewset`.
     """
     """
 
 
     #: A name for this viewset, used as the default URL prefix and namespace.
     #: A name for this viewset, used as the default URL prefix and namespace.
@@ -133,6 +135,8 @@ class ViewSetGroup(WagtailMenuRegisterableGroup):
     """
     """
     A container for grouping together multiple ViewSet instances.
     A container for grouping together multiple ViewSet instances.
     Creates a menu item with a submenu for accessing the main URL for each instances.
     Creates a menu item with a submenu for accessing the main URL for each instances.
+
+    For more information on how to use this class, see :ref:`using_base_viewsetgroup`.
     """
     """
 
 
     def on_register(self):
     def on_register(self):

+ 2 - 0
wagtail/admin/viewsets/model.py

@@ -25,6 +25,8 @@ class ModelViewSet(ViewSet):
 
 
     All attributes and methods from :class:`~wagtail.admin.viewsets.base.ViewSet`
     All attributes and methods from :class:`~wagtail.admin.viewsets.base.ViewSet`
     are available.
     are available.
+
+    For more information on how to use this class, see :ref:`generic_views`.
     """
     """
 
 
     #: Register the model to the reference index to track its usage.
     #: Register the model to the reference index to track its usage.