summaryrefslogtreecommitdiff
path: root/django/forms/widgets.py
AgeCommit message (Collapse)Author
2026-06-10Fixed #36104 -- Returned NotImplemented in Media.__add__ for non-Media RHS.Jacob Walls
2026-06-09Fixed #37147 -- Fixed rendering empty values for models with db_default on ↵Mariusz Felisiak
primary key.
2026-05-21Fixed #37088 -- Included attributes in media object equality.Johannes Maron
Since in the majority of cases the `MediaAsset.attributes` will be empty or small, there's only a tiny performance penalty. However, the accidental use of the `path` property caused a 1_000x performacne degredation (N=1_000_000).
2026-05-07Fixed #37085 -- Added support for object-based form media stylesheet assets.Natalia
Thank you James Walls and James Bligh for reviews. Co-authored-by: Johannes Maron <johannes@maron.family>
2026-05-06Fixed #36784 -- Added csp_nonce_attr template tag for CSP nonce inclusion.Natalia
New default tag `{% csp_nonce_attr %}` was added for explicit CSP nonce inclusion into `<script>` and `<link>` elements. `{% csp_nonce_attr %}` renders `nonce="<value>"` when `csp_nonce` is present in the template context, and renders nothing otherwise. `{% csp_nonce_attr media %}` renders a `Media` object's assets with the nonce attr applied to each tag. Thanks Jacob Walls for the accurate and spot on review comments. Co-authored-by: Johannes Maron <johannes@maron.family>
2025-12-31Fixed #36829 -- Reverted value of ClearableFileInput.use_fieldset to True.Johannes Maron
There was unresolved discussion regarding whether to set ClearableFileInput.use_fieldset to True or False when use_fieldset was introduced in Django 4.1, since the clear checkbox appears only sometimes. Although using <fieldset> is likely desirable, since the primary motivation in #35892 was just to improve markup in the admin, and a deprecation path was not provided for general form usage, future work is deferred to #36828. Regression in 4187da258fe212d494cb578a0bc2b52c4979ab95. Thanks Tim Graham, Antoliny, and David Smith for triage.
2025-08-19Fixed #35892 -- Supported Widget.use_fieldset in admin forms.antoliny0919
2025-07-23Refs #36500 -- Rewrapped long docstrings and block comments via a script.django-bot
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
2025-01-02Fixed #35886 -- Added support for object-based form media script assets.Johannes Maron
2024-08-02Fixed #35601 -- Added TelInput widget.lucasesposito
2024-08-02Fixed #35599 -- Added ColorInput widget.arjunomray
2024-07-31Fixed #35598 -- Added SearchInput widget.Jeremy Thompson
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
2023-08-30 Fixed #31262 -- Added support for mappings on model fields and ↵Nick Pope
ChoiceField's choices.
2023-05-03Fixed CVE-2023-31047, Fixed #31710 -- Prevented potential bypass of ↵Mariusz Felisiak
validation when uploading multiple files using one form field. Thanks Moataz Al-Sharida and nawaik for reports. Co-authored-by: Shai Berger <shai@platonix.com> Co-authored-by: nessita <124304+nessita@users.noreply.github.com>
2023-04-21Fixed #34488 -- Made ClearableFileInput preserve "Clear" checked attribute ↵Marcelo Galigniana
when form is invalid.
2023-03-22Fixed #34424 -- Fixed SelectDateWidget crash for inputs raising OverflowError.Jure Slak
2023-02-01Refs #33476 -- Applied Black's 2023 stable style.David Smith
Black 23.1.0 is released which, as the first release of the year, introduces the 2023 stable style. This incorporates most of last year's preview style. https://github.com/psf/black/releases/tag/23.1.0
2023-01-19Refs #32528 -- Simplified Media.merge().Nick Pope
This avoids building up a second datastructure for the duplicate files warning case and simply flatten and strip duplicates if that case ever arises.
2023-01-19Fixed #32528 -- Replaced django.utils.topological_sort with ↵Nick Pope
graphlib.TopologicalSort(). graphlib.TopologicalSort() is available since Python 3.9.
2022-10-31Used more augmented assignment statements.Nick Pope
Identified using the following command: $ git grep -I '\(\<[_a-zA-Z0-9]\+\>\) *= *\1 *[-+/*^%&|<>@]'
2022-08-25Fixed #33830 -- Fixed VariableDoesNotExist when rendering ClearableFileInput.Neeraj Kumar
2022-06-03Fixed documentation of Widget.id_for_label() empty return value.Swann
2022-04-26Fixed #33656 -- Fixed MultiWidget crash when compressed value is a tuple.L
2022-03-30Refs #32339 -- Added use_fieldset to Widget.David
2022-02-10Fixed #29490 -- Added support for object-based Media CSS and JS paths.Claude Paroz
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2022-01-22Stopped including type="text/css" attributes for CSS link tags.Claude Paroz
2021-12-21Fixed typo in django/forms/widgets.py.vavanade
2021-11-05Fixed #33235 -- Removed "for = ..." from MultiWidget's <label>.David Smith
This improves accessibility for screen reader users.
2021-06-22Refs #32338 -- Removed 'for ="..."' from RadioSelect's <label>.David Smith
This improves accessibility for screen reader users. Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2021-05-12Refs #32738 -- Added sanitize_strftime_format() to replace datetime_safe.Nick Pope
2021-01-27Improved performance of django.forms.ChoiceWidget.optgroups().David Smith
2021-01-19Removed unnecessary empty dict creation in ChoiceWidget.create_option().David Smith
build_atttrs() already creates an empty dict if extra_attrs is None.
2020-09-24Fixed #30563 -- Optimized form Media by removing duplicated assets when adding.David Smith
2020-09-22Corrected docstring quotes in various code.Mariusz Felisiak
2020-07-10Refs #30578 -- Made SelectDateWidget.format_value() independent of USE_L10N.Claude Paroz
2020-05-12Fixed E128, E741 flake8 warnings.Mariusz Felisiak
2020-05-06Simplified Widget.get_context() a bit.Jon Dufresne
2020-03-24Fixed #7664 -- Allowed customizing suffixes of MultiWidget.widgets' names.David Smith
2020-01-08Fixed #31118 -- Made FileInput to avoid the required attribute when initial ↵Shubham singh
data exists.
2019-12-11Fixed #31080 -- Removed redundant type="text/javascript" attribute from ↵Jon Dufresne
<script> tags.
2019-12-10Fixed #31073 -- Prevented CheckboxInput.get_context() from mutating attrs.Peter Andersen
2019-11-28Refs #23919 -- Replaced super(...) with super() in metaclasses.Jon Dufresne
2019-11-21Fixed #31012 -- Reverted "Fixed #29056 -- Fixed HTML5 validation of required ↵Carlton Gibson
SelectDateWidget." This reverts commit f038214d917c982613f5a15db8dfe325b1f7479b. The initial issue was incorrect. Django 2.2, and before, did not generate invalid HTML as reported. With f03821 in place invalid HTML was generated. Thanks to Kevin Brown for follow-up report and investigation.
2019-10-29Fixed #30899 -- Lazily compiled import time regular expressions.Hasan Ramezani
2019-06-26Fixed #30578 - Made SelectDateWidget respect a custom date format when ↵Shubham Bhagat
USE_L10N is disabled.
2019-05-08Fixed #29056 -- Fixed HTML5 validation of required SelectDateWidget.Hasan Ramezani
placeholder is required for "select" with "required" attribute.
2019-02-27Fixed #30179 -- Fixed form Media merging when pairwise merging is insufficient.Matthias Kestenholz
Thanks gasman for the tests, and codingjoe and timgraham for the review.
2019-02-09Fixed #30153 -- Fixed incorrect form Media asset ordering after three way merge.Matthias Kestenholz
Delaying merging assets as long as possible avoids introducing incorrect relative orderings that cause a broken final result.