Fixed #35748 -- Documented that fields are excluded from a ModelForm when formfield() returns None.

Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
This commit is contained in:
Clifford Gama 2024-09-10 22:38:01 +02:00 committed by Sarah Boyce
parent 4b65dc2f21
commit e1d226bc1c
2 changed files with 12 additions and 2 deletions

View file

@ -2445,6 +2445,9 @@ Field API reference
Returns the default :class:`django.forms.Field` of this field for
:class:`~django.forms.ModelForm`.
If :meth:`~Field.formfield` is overridden to return ``None``, this field
is excluded from the :class:`~django.forms.ModelForm`.
By default, if both ``form_class`` and ``choices_form_class`` are
``None``, it uses :class:`~django.forms.CharField`. If the field has
:attr:`~django.db.models.Field.choices` and ``choices_form_class``