summaryrefslogtreecommitdiff
path: root/tests/forms_tests/field_tests
AgeCommit message (Collapse)Author
2026-04-29Fixed #16429 -- Extracted set_choices() method from FilePathField.__init__().TildaDares
2026-04-22Fixed #35870 -- Made blank choice label in forms more accessible.Annabelle Wiegart
Added new constant django.db.models.fields.BLANK_CHOICE_LABEL for an accessible and translatable blank choice label in forms. Deprecated django.db.models.fields.BLANK_CHOICE_DASH constant. Added the immediately deprecated transitional setting USE_BLANK_CHOICE_DASH. Co-Authored-By: Marijke Luttekes <mail@marijkeluttekes.dev>
2026-03-26Refs #36913 -- Maintained error message determinism in ↵afenoum
MultipleChoiceField.validate(). Used Django's OrderedSet datastructure instead of set() in MultipleChoiceField.validate() to prevent submission ordering from being discarded during validation. Thanks to Jacob Walls, JaeHyuck Sa, Jake Howard and Simon Charette for the reviews.
2026-03-25Fixed #36913 -- Optimized MultipleChoiceField.validate().afenoum
2026-03-03Fixed #36923 -- Added tests for non-hierarchical URI schemes in ↵Natalia
URLField.to_python(). Follow up to 951ffb3832cd83ba672c1e3deae2bda128eb9cca.
2026-03-03Fixed CVE-2026-25673 -- Simplified URLField scheme detection.Natalia
This simplicaftion mitigates a potential DoS in URLField on Windows. The usage of `urlsplit()` in `URLField.to_python()` was replaced with `str.partition(":")` for URL scheme detection. On Windows, `urlsplit()` performs Unicode normalization which is slow for certain characters, making `URLField` vulnerable to DoS via specially crafted POST payloads. Thanks Seokchan Yoon for the report, and Jake Howard and Shai Berger for the review. Refs #36923. Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
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-02-18Refs #36005 -- Used datetime.UTC alias instead of datetime.timezone.utc.Mariusz Felisiak
datetime.UTC was added in Python 3.11.
2025-01-15Refs #34380 -- Changed the URLField default scheme to https and removed ↵Sarah Boyce
FORMS_URLFIELD_ASSUME_HTTPS per deprecation timeline.
2025-01-14Fixed CVE-2024-56374 -- Mitigated potential DoS in IPv6 validation.Michael Manfre
Thanks Saravana Kumar for the report, and Sarah Boyce and Mariusz Felisiak for the reviews. Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2025-01-08Fixed #36014 -- Supported international domains in EmailValidator.Chaitanya Rahalkar
2024-08-28Fixed #35666 -- Documented stacklevel usage and testing, and adjusted test ↵Simon Charette
suite accordingly. Over the years we've had multiple instances of hit and misses when emitting warnings: either setting the wrong stacklevel or not setting it at all. This work adds assertions for the existing warnings that were declaring the correct stacklevel, but were lacking tests for it.
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
2023-11-28Refs #34380 -- Added FORMS_URLFIELD_ASSUME_HTTPS transitional setting.Mariusz Felisiak
This allows early adoption of the new default "https".
2023-11-28Refs #34986 -- Fixed some test assertions for PyPy.Nick Pope
These failures were due to minor inconsistencies or implementation differences between CPython and PyPy.
2023-08-30 Fixed #31262 -- Added support for mappings on model fields and ↵Nick Pope
ChoiceField's choices.
2023-07-03Fixed CVE-2023-36053 -- Prevented potential ReDoS in EmailValidator and ↵Mariusz Felisiak
URLValidator. Thanks Seokchan Yoon for reports.
2023-06-16Fixed #34473 -- Fixed step validation for form fields with non-zero minimum ↵Jacob Rief
value.
2023-05-04Fixed MultipleFileFieldTest.test_file_multiple_validation() test if Pillow ↵Mariusz Felisiak
isn't installed. Follow up to fb4c55d9ec4bb812a7fb91fa20510d91645e411b.
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-28Fixed #34380 -- Allowed specifying a default URL scheme in forms.URLField.Coen van der Kamp
This also deprecates "http" as the default scheme.
2023-03-22Fixed #34424 -- Fixed SelectDateWidget crash for inputs raising OverflowError.Jure Slak
2023-03-22Refs #34434 -- Added assertion for cleaning 0-0-0 for forms.DateField.Jure Slak
2023-03-21Fixed #34388 -- Allowed using choice enumeration types directly on model and ↵T. Franzel
form fields.
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-18Refs #34233 -- Used str.removeprefix()/removesuffix().Mariusz Felisiak
2023-01-17Refs #32873 -- Removed settings.USE_L10N per deprecation timeline.Mariusz Felisiak
2022-05-12Fixed #32559 -- Added 'step_size’ to numeric form fields.Kapil Bansal
Co-authored-by: Jacob Rief <jacob.rief@uibk.ac.at>
2022-03-24Refs #32365 -- Removed internal uses of utils.timezone.utc alias.Carlton Gibson
Remaining test case ensures that uses of the alias are mapped canonically by the migration writer.
2022-02-07Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2022-02-03Refs #32559 -- Added selenium test for FloatField client-side validation.Carlton Gibson
step="any" is required for non-integer values. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number#step Covers behaviour added in 7ec2a21be15af5b2c7513482c3bcfdd1e12782ed.
2021-12-20Fixed #33367 -- Fixed URLValidator crash in some edge cases.mendespedro
2021-12-20Fixed #33368 -- Fixed parse_duration() crash on invalid separators for ↵mendespedro
decimal fractions.
2021-12-16Used subTest() in forms.URLField() tests.Mariusz Felisiak
2021-11-05Fixed #33235 -- Removed "for = ..." from MultiWidget's <label>.David Smith
This improves accessibility for screen reader users.
2021-09-14Fixed #32873 -- Deprecated settings.USE_L10N.Claude Paroz
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-08-04Fixed #29205 -- Corrected rendering of required attributes for ↵Jacob Walls
MultiValueField subfields.
2021-07-30Refs #32956 -- Updated words ending in -wards.David Smith
AP styleguide: Virtually none of the words ending with -wards end with an s.
2021-07-21Fixed #32949 -- Restored invalid number handling in DecimalField.validate().yakimka
DecimalField must itself validate() values, such as NaN, which cannot be passed to validators, such as MaxValueValidator, during the run_validators() phase. Regression in cc3d24d7d577f174937a0744d886c4c7123cfa85.
2021-06-28Fixed #32807 -- Fixed JSONField crash when redisplaying None values.Dan Strokirk
Thanks to Alex Hill for the initial patch.
2021-05-04Fixed CVE-2021-31542 -- Tightened path & file name sanitation in file uploads.Florian Apolloner
2020-10-17Fixed #32110 -- Doc'd and tested enumerations for ChoiceField.choices.Claude Paroz
2020-10-09Fixed #32080 -- Fixed displaying Unicode chars in forms.JSONField and ↵Qi Zhao
read-only JSONField values in admin.
2020-09-25Refs #28009 -- Added empty_value tests for CharField subclasses.David Smith
2020-09-25Added assertions for cleaning None values for forms.JSONField and ↵David Smith
forms.UUIDField.
2020-05-20Removed unused variable in test_datetimefield_clean_input_formats.David Smith
2020-05-08Fixed #12990, Refs #27694 -- Added JSONField model field.sage
Thanks to Adam Johnson, Carlton Gibson, Mariusz Felisiak, and Raphael Michel for mentoring this Google Summer of Code 2019 project and everyone else who helped with the patch. Special thanks to Mads Jensen, Nick Pope, and Simon Charette for extensive reviews. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-04-28Changed django.forms.ValidationError imports to ↵François Freitag
django.core.exceptions.ValidationError. Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-04-22Completed test coverage for forms.RegexField.David Smith