mirror of
https://github.com/django/django.git
synced 2025-02-04 22:47:53 +00:00
[5.0.x] Fixed #28011 -- Corrected Field.hidden docs.
Backport of 7ba6c9edc50dc989fc5c306b541636249b952f93 from main
This commit is contained in:
parent
41a4bba817
commit
23c7cbfd24
@ -2500,18 +2500,11 @@ Attributes for fields
|
|||||||
|
|
||||||
.. attribute:: Field.hidden
|
.. attribute:: Field.hidden
|
||||||
|
|
||||||
Boolean flag that indicates if a field is used to back another non-hidden
|
Boolean flag that indicates if a field is hidden and should not be returned
|
||||||
field's functionality (e.g. the ``content_type`` and ``object_id`` fields
|
by :meth:`Options.get_fields()
|
||||||
that make up a ``GenericForeignKey``). The ``hidden`` flag is used to
|
<django.db.models.options.Options.get_fields>` by default. An example is
|
||||||
distinguish what constitutes the public subset of fields on the model from
|
the reverse field for a :class:`~django.db.models.ForeignKey` with a
|
||||||
all the fields on the model.
|
``related_name`` that starts with ``'+'``.
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
:meth:`Options.get_fields()
|
|
||||||
<django.db.models.options.Options.get_fields()>`
|
|
||||||
excludes hidden fields by default. Pass in ``include_hidden=True`` to
|
|
||||||
return hidden fields in the results.
|
|
||||||
|
|
||||||
.. attribute:: Field.is_relation
|
.. attribute:: Field.is_relation
|
||||||
|
|
||||||
|
@ -79,10 +79,7 @@ Retrieving all field instances of a model
|
|||||||
|
|
||||||
``include_hidden``
|
``include_hidden``
|
||||||
``False`` by default. If set to ``True``, ``get_fields()`` will include
|
``False`` by default. If set to ``True``, ``get_fields()`` will include
|
||||||
fields that are used to back other field's functionality. This will
|
:attr:`hidden fields <django.db.models.Field.hidden>`.
|
||||||
also include any fields that have a ``related_name`` (such
|
|
||||||
as :class:`~django.db.models.ManyToManyField`, or
|
|
||||||
:class:`~django.db.models.ForeignKey`) that start with a "+".
|
|
||||||
|
|
||||||
.. code-block:: pycon
|
.. code-block:: pycon
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user