diff options
| author | Shubham singh <shubham1.singh15@gmail.com> | 2020-01-05 13:21:33 +0530 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-01-08 09:15:31 +0100 |
| commit | ffcf1a8ebfbdc8e3afac84aed88d6ed29a57c72b (patch) | |
| tree | 926c2b0ff48cb97bf5aba5a3fe2e12bff7a3b6c6 /docs/ref | |
| parent | 53d8646f799de7f92ab9defe9dc56c6125448102 (diff) | |
Fixed #31118 -- Made FileInput to avoid the required attribute when initial data exists.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/forms/widgets.txt | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt index a9c442289c..e986154753 100644 --- a/docs/ref/forms/widgets.txt +++ b/docs/ref/forms/widgets.txt @@ -325,17 +325,22 @@ foundation for custom widgets. to display the ``required`` attribute for each field. By default, returns ``False`` for hidden widgets and ``True`` - otherwise. Special cases are :class:`~django.forms.ClearableFileInput`, - which returns ``False`` when ``initial`` is set, and - :class:`~django.forms.CheckboxSelectMultiple`, which always returns - ``False`` because browser validation would require all checkboxes to be - checked instead of at least one. + otherwise. Special cases are :class:`~django.forms.FileInput` and + :class:`~django.forms.ClearableFileInput`, which return ``False`` when + ``initial`` is set, and :class:`~django.forms.CheckboxSelectMultiple`, + which always returns ``False`` because browser validation would require + all checkboxes to be checked instead of at least one. Override this method in custom widgets that aren't compatible with browser validation. For example, a WSYSIWG text editor widget backed by a hidden ``textarea`` element may want to always return ``False`` to avoid browser validation on the hidden field. + .. versionchanged:: 3.1 + + In older versions, ``True`` was returned for + :class:`~django.forms.FileInput` when ``initial`` was set. + ``MultiWidget`` --------------- |
