mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-03-19 15:30:37 +00:00
Conflicts: docs/advanced_topics/api/v2/configuration.rst docs/advanced_topics/jinja2.rst docs/advanced_topics/settings.rst docs/getting_started/integrating_into_django.rst docs/getting_started/tutorial.rst docs/topics/pages.rst docs/topics/streamfield.rst gulpfile.js/config.js tox.ini wagtail/admin/tests/test_compare.py wagtail/admin/tests/test_edit_handlers.py wagtail/api/v2/signal_handlers.py wagtail/contrib/wagtailstyleguide/views.py wagtail/core/tests/test_streamfield.py wagtail/documents/tests/test_models.py wagtail/images/models.py wagtail/images/permissions.py wagtail/images/tests/test_admin_views.py wagtail/images/tests/test_image_operations.py wagtail/images/tests/test_models.py wagtail/images/tests/test_signal_handlers.py wagtail/images/views/chooser.py wagtail/images/views/images.py wagtail/images/views/multiple.py wagtail/images/wagtail_hooks.py wagtail/images/widgets.py wagtail/project_template/project_name/settings/base.py wagtail/tests/demosite/models.py wagtail/tests/non_root_urls.py wagtail/tests/settings.py wagtail/tests/testapp/migrations/0001_initial.py wagtail/tests/testapp/migrations/0008_inlinestreampage_inlinestreampagesection.py wagtail/tests/testapp/migrations/0009_defaultstreampage.py wagtail/tests/urls.py
102 lines
3.5 KiB
ReStructuredText
102 lines
3.5 KiB
ReStructuredText
======================================
|
|
Enabling & customising ``InspectView``
|
|
======================================
|
|
|
|
The ``InspectView`` is disabled by default, as it's not often useful for most
|
|
models. However, if you need a view that enables users to view more detailed
|
|
information about an instance without the option to edit it, you can easily
|
|
enable the inspect view by setting ``inspect_view_enabled=True`` on your
|
|
``ModelAdmin`` class.
|
|
|
|
When enabled, an 'Inspect' button will automatically appear for each row in
|
|
your index / listing view, linking to new page that shows values a list of
|
|
field values for that particular object.
|
|
|
|
By default, all 'concrete' fields (where the field value is stored as a column
|
|
in the database table for your model) will be shown. You can customise what
|
|
values are displayed by adding the following attributes to your ``ModelAdmin``
|
|
class:
|
|
|
|
.. contents::
|
|
:local:
|
|
:depth: 1
|
|
|
|
.. _modeladmin_inspect_view_fields:
|
|
|
|
------------------------------------------
|
|
``ModelAdmin.inspect_view_fields``
|
|
------------------------------------------
|
|
|
|
**Expected value:** A list or tuple, where each item is the name of a field
|
|
or attribute on the instance that you'd like ``InpectView`` to render.
|
|
|
|
A sensible value will be rendered for most field types.
|
|
|
|
If you have ``wagtail.images`` installed, and the value happens to be an
|
|
instance of ``wagtailimages.models.Image`` (or a custom model that subclasses
|
|
``wagtailimages.models.AbstractImage``), a thumbnail of that image will be
|
|
rendered.
|
|
|
|
If you have `wagtail.documents` installed, and the value happens to be an
|
|
instance of `wagtaildocs.models.Document` (or a custom model that subclasses
|
|
``wagtaildocs.models.AbstractDocument``), a link to that document will be
|
|
rendered, along with the document title, file extension and size.
|
|
|
|
.. _modeladmin_inspect_view_fields_exclude:
|
|
|
|
------------------------------------------
|
|
``ModelAdmin.inspect_view_fields_exclude``
|
|
------------------------------------------
|
|
|
|
**Expected value:** A list or tuple, where each item is the name of a field
|
|
that you'd like to exclude from ``InpectView``
|
|
|
|
**Note:** If both ``inspect_view_fields`` and ``inspect_view_fields_exclude``
|
|
are set, ``inspect_view_fields_exclude`` will be ignored.
|
|
|
|
.. _modeladmin_inspect_view_extra_css:
|
|
|
|
-------------------------------------
|
|
``ModelAdmin.inspect_view_extra_css``
|
|
-------------------------------------
|
|
|
|
**Expected value**: A list of path names of additional stylesheets to be added
|
|
to the ``InspectView``
|
|
|
|
See the following part of the docs to find out more:
|
|
:ref:`modeladmin_adding_css_and_js`
|
|
|
|
.. _modeladmin_inspect_view_extra_js:
|
|
|
|
------------------------------------
|
|
``ModelAdmin.inspect_view_extra_js``
|
|
------------------------------------
|
|
|
|
**Expected value**: A list of path names of additional js files to be added
|
|
to the ``InspectView``
|
|
|
|
See the following part of the docs to find out more:
|
|
:ref:`modeladmin_adding_css_and_js`
|
|
|
|
.. _modeladmin_inspect_template_name:
|
|
|
|
---------------------------------------
|
|
``ModelAdmin.inspect_template_name``
|
|
---------------------------------------
|
|
|
|
**Expected value**: The path to a custom template to use for ``InspectView``
|
|
|
|
See the following part of the docs to find out more:
|
|
:ref:`modeladmin_overriding_templates`
|
|
|
|
.. _modeladmin_inspect_view_class:
|
|
|
|
---------------------------------------
|
|
``ModelAdmin.inspect_view_class``
|
|
---------------------------------------
|
|
|
|
**Expected value**: A custom ``view`` class to replace
|
|
``modeladmin.views.InspectView``
|
|
|
|
See the following part of the docs to find out more:
|
|
:ref:`modeladmin_overriding_views`
|