2022-06-09 13:48:47 +00:00
# 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 ).
2022-06-10 19:29:32 +00:00
## ViewSet
2022-06-09 13:48:47 +00:00
2022-06-10 19:29:32 +00:00
```{eval-rst}
2022-06-09 13:48:47 +00:00
.. autoclass:: wagtail.admin.viewsets.base.ViewSet
.. automethod:: on_register
.. automethod:: get_urlpatterns
.. automethod:: get_url_name
2022-06-10 19:29:32 +00:00
```
2022-06-09 14:26:30 +00:00
2022-06-10 19:29:32 +00:00
## ModelViewSet
2022-06-09 14:26:30 +00:00
2022-06-10 19:29:32 +00:00
```{eval-rst}
2022-06-09 14:26:30 +00:00
.. autoclass:: wagtail.admin.viewsets.model.ModelViewSet
.. attribute:: model
Required; the model class that this viewset will work with.
.. attribute:: form_fields
A list of model field names that should be included in the create / edit forms.
.. attribute:: exclude_form_fields
Used in place of ``form_fields`` to indicate that all of the model's fields except the ones listed here should appear in the create / edit forms. Either ``form_fields`` or ``exclude_form_fields`` must be supplied (unless ``get_form_class`` is being overridden).
.. automethod:: get_form_class
.. autoattribute:: icon
.. autoattribute:: index_view_class
.. autoattribute:: add_view_class
.. autoattribute:: edit_view_class
.. autoattribute:: delete_view_class
2022-06-10 19:29:32 +00:00
```
2022-06-09 14:59:52 +00:00
2022-06-10 19:29:32 +00:00
## ChooserViewSet
2022-06-09 14:59:52 +00:00
2022-06-10 19:29:32 +00:00
```{eval-rst}
2022-06-09 14:59:52 +00:00
.. autoclass:: wagtail.admin.viewsets.chooser.ChooserViewSet
.. attribute:: model
Required; the model class that this viewset will work with.
.. autoattribute:: icon
.. autoattribute:: choose_one_text
.. autoattribute:: page_title
.. autoattribute:: choose_another_text
.. autoattribute:: edit_item_text
2022-07-14 11:33:28 +00:00
.. autoattribute:: per_page
2022-06-09 14:59:52 +00:00
.. autoattribute:: choose_view_class
.. autoattribute:: choose_results_view_class
.. autoattribute:: chosen_view_class
2022-06-22 11:29:27 +00:00
.. autoattribute:: create_view_class
2022-07-07 22:37:03 +00:00
.. autoattribute:: base_widget_class
2022-06-09 14:59:52 +00:00
.. autoattribute:: widget_class
2022-08-17 12:26:59 +00:00
.. autoattribute:: widget_telepath_adapter_class
2022-06-09 14:59:52 +00:00
.. autoattribute:: register_widget
2022-07-07 22:37:03 +00:00
.. autoattribute:: base_block_class
2022-08-16 13:58:40 +00:00
.. automethod:: get_block_class
2022-06-21 17:11:27 +00:00
.. autoattribute:: creation_form_class
.. autoattribute:: form_fields
.. autoattribute:: exclude_form_fields
.. autoattribute:: create_action_label
.. autoattribute:: create_action_clicked_label
.. autoattribute:: creation_tab_label
.. autoattribute:: search_tab_label
2022-06-09 13:48:47 +00:00
```
2022-09-14 14:33:32 +00:00
## SnippetViewSet
```{eval-rst}
.. autoclass:: wagtail.snippets.views.snippets.SnippetViewSet
2022-09-27 11:58:11 +00:00
.. autoattribute:: list_display
2022-09-14 14:33:32 +00:00
.. autoattribute:: filterset_class
.. autoattribute:: index_view_class
.. autoattribute:: add_view_class
.. autoattribute:: edit_view_class
.. autoattribute:: delete_view_class
.. autoattribute:: usage_view_class
.. autoattribute:: history_view_class
.. autoattribute:: revisions_view_class
.. autoattribute:: revisions_revert_view_class
.. autoattribute:: revisions_compare_view_class
.. autoattribute:: unpublish_view_class
.. autoattribute:: preview_on_add_view_class
.. autoattribute:: preview_on_edit_view_class
```