Browse Source

Move viewset intro in generic views docs to the base `ViewSet` usage docs

Sage Abdullah 1 năm trước cách đây
mục cha
commit
c9514345d9
2 tập tin đã thay đổi với 5 bổ sung3 xóa
  1. 4 2
      docs/extending/admin_views.md
  2. 1 1
      docs/extending/generic_views.md

+ 4 - 2
docs/extending/admin_views.md

@@ -232,7 +232,9 @@ The 'Calendar' item will now appear as a group of menu items. When expanded, the
 
 ## Using `ViewSet` to group custom admin views
 
-Wagtail provides a {class}`~wagtail.admin.viewsets.base.ViewSet` class that combines the registration of views and the associated menu item into a single class. For example, you can group the calendar views from the previous example into a single menu item by creating a `ViewSet` subclass in `views.py`:
+Registering admin views along with their URLs and menu items is a common pattern in Wagtail. This often involves several related views with shared properties such as the model that we're working with, and its associated icon. To support the pattern, Wagtail implements the concept of a _viewset_, which allows a bundle of views and their URLs to be defined collectively, along with a menu item to be registered with the admin app as a single operation through the [`register_admin_viewset`](register_admin_viewset) hook.
+
+For example, you can group the calendar views from the previous example into a single menu item by creating a {class}`~wagtail.admin.viewsets.base.ViewSet` subclass in `views.py`:
 
 ```{code-block} python
 from wagtail.admin.viewsets.base import ViewSet
@@ -261,7 +263,7 @@ class CalendarViewSet(ViewSet):
         ]
 ```
 
-Then, remove the `register_admin_urls` and `register_admin_menu_item` hooks in `wagtail_hooks.py` in favor of registering the `ViewSet` subclass with the [`register_admin_viewset`](register_admin_viewset) hook:
+Then, remove the `register_admin_urls` and `register_admin_menu_item` hooks in `wagtail_hooks.py` in favor of registering the `ViewSet` subclass with the `register_admin_viewset` hook:
 
 ```{code-block} python
 from .views import CalendarViewSet

+ 1 - 1
docs/extending/generic_views.md

@@ -2,7 +2,7 @@
 
 # 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. For convenience, these views are bundled in [viewsets](viewsets_reference).
 
 ## ModelViewSet