kopia lustrzana https://github.com/wagtail/wagtail
Improve linking in existing viewsets docs
rodzic
f8fa8e99d8
commit
38a5a582e9
|
|
@ -1,3 +1,6 @@
|
|||
```{module} wagtail.admin.viewsets
|
||||
```
|
||||
|
||||
(viewsets_reference)=
|
||||
|
||||
# Viewsets
|
||||
|
|
@ -61,8 +64,8 @@ Viewsets are Wagtail's mechanism for defining a group of related admin views wit
|
|||
.. attribute:: model
|
||||
|
||||
Required; the model class that this viewset will work with. The :attr:`~django.db.models.Options.model_name` will be used
|
||||
as the URL prefix and namespace, unless these are specified explicitly via the ``name``, ``url_prefix`` or
|
||||
``url_namespace`` attributes.
|
||||
as the URL prefix and namespace, unless these are specified explicitly via the :attr:`~.ViewSet.name`, :attr:`~.ViewSet.url_prefix` or
|
||||
:attr:`~.ViewSet.url_namespace` attributes.
|
||||
|
||||
.. attribute:: form_fields
|
||||
|
||||
|
|
@ -70,7 +73,7 @@ Viewsets are Wagtail's mechanism for defining a group of related admin views wit
|
|||
|
||||
.. 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).
|
||||
Used in place of :attr:`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 :meth:`get_form_class` is being overridden).
|
||||
|
||||
.. automethod:: get_form_class
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class ViewSet(WagtailMenuRegisterable):
|
|||
|
||||
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
|
||||
attributes). Additionally, the ``name`` property can be passed as the first positional
|
||||
attributes). Additionally, the :attr:`name` property can be passed as the first positional
|
||||
argument to the constructor.
|
||||
|
||||
For more information on how to use this class, see :ref:`using_base_viewset`.
|
||||
|
|
@ -77,11 +77,11 @@ class ViewSet(WagtailMenuRegisterable):
|
|||
def url_prefix(self):
|
||||
"""
|
||||
The preferred URL prefix for views within this viewset. When registered through
|
||||
Wagtail's ``register_admin_viewset`` hook, this will be used as the URL path component
|
||||
following ``/admin/``. Other URL registration mechanisms (e.g. editing urls.py manually)
|
||||
Wagtail's :ref:`register_admin_viewset` hook, this will be used as the URL path component
|
||||
following ``/admin/``. Other URL registration mechanisms (e.g. editing ``urls.py`` manually)
|
||||
may disregard this and use a prefix of their own choosing.
|
||||
|
||||
Defaults to the viewset's name.
|
||||
Defaults to the viewset's ``name``.
|
||||
"""
|
||||
if not self.name:
|
||||
raise ImproperlyConfigured(
|
||||
|
|
@ -96,7 +96,7 @@ class ViewSet(WagtailMenuRegisterable):
|
|||
application namespace for the viewset's URLs, and generally be the instance namespace
|
||||
too.
|
||||
|
||||
Defaults to the viewset's name.
|
||||
Defaults to the viewset's ``name``.
|
||||
"""
|
||||
if not self.name:
|
||||
raise ImproperlyConfigured(
|
||||
|
|
@ -133,7 +133,7 @@ class ViewSet(WagtailMenuRegisterable):
|
|||
|
||||
class ViewSetGroup(WagtailMenuRegisterableGroup):
|
||||
"""
|
||||
A container for grouping together multiple ViewSet instances.
|
||||
A container for grouping together multiple :class:`ViewSet` 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`.
|
||||
|
|
|
|||
|
|
@ -577,13 +577,13 @@ class SnippetViewSet(ModelViewSet):
|
|||
#: The URL namespace to use for the admin views.
|
||||
#: If left unset, ``wagtailsnippets_{app_label}_{model_name}`` is used instead.
|
||||
#:
|
||||
#: **Deprecated** - the preferred attribute to customise is ``url_namespace``.
|
||||
#: **Deprecated** - the preferred attribute to customise is :attr:`~.ViewSet.url_namespace`.
|
||||
admin_url_namespace = None
|
||||
|
||||
#: The base URL path to use for the admin views.
|
||||
#: If left unset, ``snippets/{app_label}/{model_name}`` is used instead.
|
||||
#:
|
||||
#: **Deprecated** - the preferred attribute to customise is ``url_prefix``.
|
||||
#: **Deprecated** - the preferred attribute to customise is :attr:`~.ViewSet.url_prefix`.
|
||||
base_url_path = None
|
||||
|
||||
#: The URL namespace to use for the chooser admin views.
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue