Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Note about non-field support in ModelAdmin.fields/fieldsets. #762

Closed
wants to merge 1 commit into from

2 participants

@zsiciarz

Added a note to documentation in response to this issue: https://code.djangoproject.com/ticket/19887 .

@timgraham
Owner

Thanks

@timgraham timgraham closed this
@zsiciarz zsiciarz deleted the zsiciarz:ticket_19887 branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 0 deletions.
  1. +13 −0 docs/ref/contrib/admin/index.txt
View
13 docs/ref/contrib/admin/index.txt
@@ -186,6 +186,13 @@ subclass::
values defined in :attr:`ModelAdmin.readonly_fields` to be displayed as
read-only.
+ .. admonition:: Note
+
+ The ``fields`` option, unlike :attr:`~ModelAdmin.list_display`, may
+ contain only field names of the model or the form specified by
+ :attr:`~ModelAdmin.form`, not callables. However it *can* contain
+ callables if they are defined in :attr:`~ModelAdmin.readonly_fields`.
+
To display multiple fields on the same line, wrap those fields in their own
tuple. In this example, the ``url`` and ``title`` fields will display on the
same line and the ``content`` field will be displayed below them in its
@@ -265,6 +272,12 @@ subclass::
``fields`` can contain values defined in
:attr:`~ModelAdmin.readonly_fields` to be displayed as read-only.
+ .. admonition:: Note
+
+ If you add a callable name to ``fields``, the same rule applies as
+ with :attr:`~ModelAdmin.fields` option: the callable has to be
+ specified in :attr:`~ModelAdmin.readonly_fields`.
+
* ``classes``
A list containing extra CSS classes to apply to the fieldset.
Something went wrong with that request. Please try again.