Skip to content

Commit

Permalink
Fixed #28011 -- Corrected Field.hidden docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz authored and felixxm committed Feb 17, 2024
1 parent d1be05b commit 7ba6c9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
17 changes: 5 additions & 12 deletions docs/ref/models/fields.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2489,18 +2489,11 @@ Attributes for fields

.. attribute:: Field.hidden

Boolean flag that indicates if a field is used to back another non-hidden
field's functionality (e.g. the ``content_type`` and ``object_id`` fields
that make up a ``GenericForeignKey``). The ``hidden`` flag is used to
distinguish what constitutes the public subset of fields on the model from
all the fields on the model.

.. 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.
Boolean flag that indicates if a field is hidden and should not be returned
by :meth:`Options.get_fields()
<django.db.models.options.Options.get_fields>` by default. An example is
the reverse field for a :class:`~django.db.models.ForeignKey` with a
``related_name`` that starts with ``'+'``.

.. attribute:: Field.is_relation

Expand Down
5 changes: 1 addition & 4 deletions docs/ref/models/meta.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@ Retrieving all field instances of a model

``include_hidden``
``False`` by default. If set to ``True``, ``get_fields()`` will include
fields that are used to back other field's functionality. This will
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 "+".
:attr:`hidden fields <django.db.models.Field.hidden>`.

.. code-block:: pycon

Expand Down

0 comments on commit 7ba6c9e

Please sign in to comment.