From e1d226bc1c52a0165164e5b34fef1d336050ca60 Mon Sep 17 00:00:00 2001 From: Clifford Gama Date: Tue, 10 Sep 2024 22:38:01 +0200 Subject: 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> --- docs/ref/models/fields.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'docs/ref') diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 5266135dd2..899947c17f 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -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`` -- cgit v1.3