Commit Graph

503 Commits

Author SHA1 Message Date
Mariusz Felisiak 882647a82c
Used subTest() in forms.URLField() tests. 2021-12-16 06:35:44 +01:00
Adam Johnson 0d2435328a Added test for field names of ManagementForm. 2021-12-10 10:01:33 +01:00
David Smith eba9a9b7f7 Refs #32338 -- Added Boundfield.legend_tag(). 2021-12-09 07:16:33 +01:00
Mariusz Felisiak 628b6a6869 Updated translations from Transifex.
This also fixes related i18n tests.

Forwardport of 4c5215ab03 from stable/4.0.x

Co-authored-by: Claude Paroz <claude@2xlibre.net>
2021-12-06 20:31:03 +01:00
David Smith c6c6cd3c5a Fixed #33235 -- Removed "for = ..." from MultiWidget's <label>.
This improves accessibility for screen reader users.
2021-11-05 11:05:52 +01:00
Carlton Gibson 2ccc0b22db Fixed #33211 -- Updated tests for Selenium 4.0.0.
Replaced deprecated `find_element[s]_by_*()` usages, in favour of
`find_element[s]()` with an explicit `By`.
2021-10-21 14:37:16 +02:00
David Smith 4884a87e02 Fixed #33134 -- Fixed recursion depth error when rendering Form with BoundFields.
Regression in 456466d932.
2021-09-29 08:04:42 +02:00
Jaap Roes 7fe9b6f6df Fixed #33130 -- Restored form errors to be a dict.
Regression in 456466d932.
2021-09-24 10:50:41 +02:00
Mariusz Felisiak 881a479911
Refs #31026 -- Fixed forms_tests if Jinja2 is not installed. 2021-09-21 10:16:44 +02:00
David Smith 456466d932 Fixed #31026 -- Switched form rendering to template engine.
Thanks Carlton Gibson, Keryn Knight, Mariusz Felisiak, and Nick Pope
for reviews.

Co-authored-by: Johannes Hoppe <info@johanneshoppe.com>
2021-09-20 15:50:18 +02:00
David Smith 4ca508a689 Refs #31026 -- Added extra form render tests. 2021-09-17 09:21:10 +02:00
David Smith 91e8b95d5b Refs #31026 -- Moved Template tests to separate class. 2021-09-17 09:20:02 +02:00
Claude Paroz 676bd084f2 Fixed #32873 -- Deprecated settings.USE_L10N.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-09-14 12:05:43 +02:00
David Smith 5942ab5eb1 Refs #32338 -- Made RadioSelect/CheckboxSelectMultiple render in <div> tags.
This improves accessibility for screen reader users.
2021-08-27 06:14:01 +02:00
David Smith 3a6431db54 Refs #29205 -- Added MultiValueField test for rendering of optional subfields. 2021-08-10 12:49:06 +02:00
Jacob Walls 2d0ae8da80 Fixed #29205 -- Corrected rendering of required attributes for MultiValueField subfields. 2021-08-04 17:37:04 +02:00
Jacob Rief db1fc5cd3c Fixed #32855 -- Corrected BoundWidget.id_for_label() with custom auto_id. 2021-08-04 15:18:00 +02:00
Ties Jan Hefting 4f3acf9579 Fixed #32984 -- Allowed customizing a deletion field widget in formsets. 2021-08-03 13:12:50 +02:00
Ties Jan Hefting 47cb85b542 Fixed typos in tests/forms_tests/tests/test_formsets.py. 2021-08-03 12:53:45 +02:00
David Smith fbb1984046
Refs #32956 -- Updated words ending in -wards.
AP styleguide: Virtually none of the words ending with -wards end with
an s.
2021-07-30 20:34:50 +02:00
yakimka c542d0a072 Fixed #32949 -- Restored invalid number handling in DecimalField.validate().
DecimalField must itself validate() values, such as NaN, which cannot be
passed to validators, such as MaxValueValidator, during the
run_validators() phase.

Regression in cc3d24d7d5.
2021-07-21 10:20:24 +02:00
Chris Jerdonek 0dc25526d8 Fixed #32924 -- Changed BaseForm.get_initial_for_field() to remove microseconds when needed. 2021-07-16 15:51:20 +02:00
Chris Jerdonek 788441c6ab Refs #32924 -- Changed test_initial_datetime_values() to use subTests. 2021-07-16 15:51:20 +02:00
Chris Jerdonek 469e769299 Refs #32924 -- Changed test_get_initial_for_field() to use subTests. 2021-07-16 15:51:20 +02:00
Chris Jerdonek 90a33ab2ce Fixed #32920 -- Changed BaseForm to access its values through bound fields. 2021-07-15 10:47:02 +02:00
Ties Jan Hefting 84400d2e9d Fixed #32905 -- Added CSS class for non-form errors of formsets. 2021-07-15 07:00:39 +02:00
Dan Strokirk f5ea9aa2f3 Fixed #32807 -- Fixed JSONField crash when redisplaying None values.
Thanks to Alex Hill for the initial patch.
2021-06-28 11:02:08 +02:00
David Smith b9e872b593 Refs #32338 -- Removed 'for ="..."' from RadioSelect's <label>.
This improves accessibility for screen reader users.

Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2021-06-22 10:59:29 +02:00
Nick Pope 46346f8ea0 Refs #32738 -- Added sanitize_strftime_format() to replace datetime_safe. 2021-05-12 14:42:17 +02:00
Florian Apolloner 0b79eb3691 Fixed CVE-2021-31542 -- Tightened path & file name sanitation in file uploads. 2021-05-04 08:44:42 +02:00
Jerin Peter George 1adc09064f Fixed #32347 -- Made ModelChoiceField include the value in ValidationError for invalid_choice. 2021-01-26 09:31:53 +01:00
Mariusz Felisiak bf770cc825 Refs #8760 -- Removed "list" message for ModelMultipleChoiceField per deprecation timeline. 2021-01-14 17:50:04 +01:00
Jon Dufresne 859cd7c6b4
Fixed #22276 -- Fixed crash when formset management form is invalid.
Co-authored-by: Patryk Zawadzki <patrys@room-303.com>
2020-11-05 10:40:41 +01:00
manav014 096b14f0ac Fixed #13060 -- Improved error message when ManagementForm data is missing. 2020-10-21 11:47:07 +02:00
Claude Paroz 7f85498eef Fixed #32110 -- Doc'd and tested enumerations for ChoiceField.choices. 2020-10-17 20:30:57 +02:00
Qi Zhao de81676b51 Fixed #32080 -- Fixed displaying Unicode chars in forms.JSONField and read-only JSONField values in admin. 2020-10-09 08:14:17 +02:00
meghanabhange 848770dd2c Fixed #32042 -- Improved error messages for the number of submitted forms in formsets. 2020-09-28 07:05:34 +02:00
David Smith b8239cae19 Refs #28009 -- Added empty_value tests for CharField subclasses. 2020-09-25 12:33:54 +02:00
David Smith 997f87c5b0 Added assertions for cleaning None values for forms.JSONField and forms.UUIDField. 2020-09-25 10:12:01 +02:00
David Smith 599f2f79e2 Fixed #30563 -- Optimized form Media by removing duplicated assets when adding. 2020-09-24 13:53:06 +02:00
David Smith 1ac337cca6 Refs #30563 -- Added tests for merging form Media with different ordering. 2020-09-24 13:53:02 +02:00
Mariusz Felisiak 75d7af43c1
Corrected docstring quotes in various code. 2020-09-22 10:30:53 +02:00
Jon Dufresne 83fbaa9231 Fixed #31806 -- Made validators include the value in ValidationErrors. 2020-07-27 13:03:26 +02:00
Jon Dufresne 013e06bb37 Refs #31806 -- Added tests for including the value in some ValidationErrors. 2020-07-27 13:03:19 +02:00
Claude Paroz 00727d384b Refs #30578 -- Made SelectDateWidget.format_value() independent of USE_L10N. 2020-07-10 13:00:37 +02:00
David Smith 162765d6c3 Fixed #9061 -- Allowed FormSets to disable deleting extra forms.
Thanks to Dan Ward for the initial patch.
2020-06-24 09:26:25 +02:00
David Smith 433dd737f9 Fixed #20347 -- Allowed customizing the maximum number of instantiated forms in formsets.
Co-authored-by: ethurgood <ethurgood@gmail.com>
2020-06-05 12:01:32 +02:00
David Smith b5aa9cb20f Refs #20347 -- Added test for formset_factory()'s absolute_max default.
Co-authored-by: ethurgood <ethurgood@gmail.com>
2020-06-05 10:00:25 +02:00
Carles Pina e46c2326c8 Fixed #31536 -- Fixed rendering of disabled AdminFileWidget and ClearableFileInput. 2020-06-01 12:25:25 +02:00
David Smith e875fac886
Removed unused variable in test_datetimefield_clean_input_formats. 2020-05-20 06:02:28 +02:00
sage 6789ded0a6 Fixed #12990, Refs #27694 -- Added JSONField model field.
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-05-08 07:23:31 +02:00
François Freitag 9ef4a18dbe Changed django.forms.ValidationError imports to django.core.exceptions.ValidationError.
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-04-28 10:49:00 +02:00
David Smith 9a015f4e0d Completed test coverage for forms.RegexField. 2020-04-22 10:50:35 +02:00
Jon Dufresne 505fec6bad Capitalized Unicode in docs, strings, and comments. 2020-04-20 12:10:33 +02:00
David Smith c8c9dbfc63 Completed test coverage for BoundField.css_classes(). 2020-04-10 07:37:54 +02:00
David Smith a350bfa6f4 Fixed #13009 -- Added BoundField.widget_type property. 2020-04-10 07:11:14 +02:00
David Smith 911545da1d Increased test coverage for forms.ImageField.to_python(). 2020-04-09 08:45:31 +02:00
David Smith 5fbc0e07a9 Completed test coverage for forms.DurationField.to_python(). 2020-04-07 06:20:43 +02:00
David Smith be9dd70931
Fixed typo in tests/forms_tests/field_tests/test_imagefield.py test names. 2020-04-07 06:04:51 +02:00
David Smith 27746ab28a Fixed #7664 -- Allowed customizing suffixes of MultiWidget.widgets' names. 2020-03-24 20:05:18 +01:00
David Smith ccf32aca44 Fixed #8760 -- Changed ModelMultipleChoiceField to use invalid_list as a error message key. 2020-03-12 09:36:01 +01:00
David Smith 5cc2c63f90
Fixed typo in tests/forms_tests/widget_tests/test_clearablefileinput.py docstring. 2020-03-11 08:50:51 +01:00
Hasan Ramezani 49275c5488 Fixed #30261 -- Prevented Form._html_output() from mutating errors if hidden fields have errors. 2020-02-13 08:12:44 +01:00
Shubham singh ffcf1a8ebf Fixed #31118 -- Made FileInput to avoid the required attribute when initial data exists. 2020-01-08 09:15:31 +01:00
Claude Paroz 1487f16f2d Fixed #11385 -- Made forms.DateTimeField accept ISO 8601 date inputs.
Thanks José Padilla for the initial patch, and Carlton Gibson for the
review.
2020-01-06 10:52:09 +01:00
Claude Paroz 495d7a1ddf Reorganized forms.DateTimeField tests. 2020-01-03 10:36:58 +01:00
Jon Dufresne e703b93a65 Fixed #31080 -- Removed redundant type="text/javascript" attribute from <script> tags. 2019-12-11 09:49:54 +01:00
Peter Andersen 02eff7ef60 Fixed #31073 -- Prevented CheckboxInput.get_context() from mutating attrs. 2019-12-10 12:27:50 +01:00
Carlton Gibson ee4a19053a Fixed #31012 -- Reverted "Fixed #29056 -- Fixed HTML5 validation of required SelectDateWidget."
This reverts commit f038214d91.

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-11-21 20:53:31 +01:00
Nick Pope 7552de7866 Used more specific unittest assertions in tests.
* assertIsNone()/assertIsNotNone() instead of comparing to None.
* assertLess() for < comparisons.
* assertIs() for 'is' expressions.
* assertIsInstance() for isinstance() expressions.
* rounding of assertAlmostEqual() for round() expressions.
* assertIs(..., True/False) instead of comparing to True/False.
* assertIs()/assertIsNot() for ==/!= comparisons.
* assertNotEqual() for == comparisons.
* assertTrue()/assertFalse() instead of comparing to True/False.
2019-10-29 12:37:30 +01:00
Hasan Ramezani 6c6d24a4fe Refs #30908 -- Added test for nonexistent path in forms.FilePathField. 2019-10-29 08:39:56 +01:00
Hasan Ramezani a28d1b38e5 Fixed #30839 -- Fixed Field.__deepcopy__() so forms don't share error messages. 2019-10-08 10:07:05 +02:00
Min ho Kim 65e86948b8 Corrected several typos in string literals and test names. 2019-08-07 11:23:14 +02:00
Jon Dufresne d89053585e Improved error message when index in __getitem__() is invalid. 2019-07-23 20:12:08 +02:00
Jon Dufresne 42b9a23267 Fixed #30400 -- Improved typography of user facing strings.
Thanks Claude Paroz for assistance with translations.
2019-06-28 16:46:18 +02:00
Shubham Bhagat 26d16c07fd Fixed #30578 - Made SelectDateWidget respect a custom date format when USE_L10N is disabled. 2019-06-26 11:07:11 +02:00
Mariusz Felisiak b08a18f17b
Fixed LiveWidgetTests.test_textarea_trailing_newlines() crash on Chrome 75+. 2019-06-18 11:38:51 +02:00
Hasan Ramezani f038214d91 Fixed #29056 -- Fixed HTML5 validation of required SelectDateWidget.
placeholder is required for "select" with "required" attribute.
2019-05-08 12:46:30 +02:00
Jon Dufresne 8d76443aba Fixed #30399 -- Changed django.utils.html.escape()/urlize() to use html.escape()/unescape(). 2019-04-25 15:09:07 +02:00
Krisjanis Vaiders 79d3b905df Fixed #30358 -- Removed redundant assertion in FormsUtilsTestCase.test_error_dict_copy(). 2019-04-13 18:42:11 +02:00
Carlton Gibson d64808cacd Used a picklable argument for a subTest. 2019-03-21 13:56:05 -04:00
Hasan Ramezani 5fc5d93512 Fixed #29956 -- Allowed overriding an order field widget in formsets. 2019-03-21 11:51:01 +01:00
Mariusz Felisiak d77657737f
Simplified forms_tests.tests.test_formsets. 2019-03-12 15:46:39 +01:00
Andra Denis Ionescu 4c086d7da4 Fixed #29459 -- Initialized form data/files with empty MultiValueDicts. 2019-03-05 10:41:08 -05:00
Matthias Kestenholz 231b513926 Fixed #30179 -- Fixed form Media merging when pairwise merging is insufficient.
Thanks gasman for the tests, and codingjoe and timgraham for the review.
2019-02-27 16:39:17 -05:00
Matthias Kestenholz 959d0c078a Fixed #30153 -- Fixed incorrect form Media asset ordering after three way merge.
Delaying merging assets as long as possible avoids introducing
incorrect relative orderings that cause a broken final result.
2019-02-09 09:38:52 -05:00
Tim Graham 0004daa536
Used 4 space hanging indent for dictionaries.
Thanks Mariusz Felisiak for auditing.
2019-01-02 18:18:19 -05:00
Tim Graham 043bd70942 Updated test URL patterns to use path() and re_path(). 2018-12-31 10:47:32 -05:00
Basil Dubyk 35a08b8541 Fixed #17210 -- Made NullBooleanSelect use unknown/true/false as query data. 2018-11-14 13:43:34 -05:00
Sergey Fedoseev 8ef8bc0f64 Refs #28909 -- Simplifed code using unpacking generalizations. 2018-09-28 09:57:12 -04:00
Tim Graham 838d6dcb86 Refs #29426 -- Made UUIDField render values with dashes. 2018-08-18 08:20:21 -04:00
Tim Graham 730173d1c5 Fixed #29623 -- Fixed translation failure of DurationField's "overflow" error message. 2018-08-08 06:24:52 -04:00
luz.paz 97e637a87f Fixed typos in comments and docs. 2018-08-01 16:09:22 -04:00
Tim Graham 76852c3989 Refs #29600 -- Added test for datetime_safe usage in SelectDateWidget.value_from_datadict(). 2018-07-26 16:51:40 -04:00
Morgan Aubert 704443acac Fixed #29363 -- Added SimpleTestCase.assertWarnsMessage(). 2018-05-09 11:40:28 -04:00
CHI Cheng 4660ce5a69 Fixed #29375 -- Removed empty action attribute on HTML forms. 2018-05-02 09:20:04 -04:00
safu9 9fd9f8bbb2 Fixed #29284 -- Made ImageField render with accept="image/*"' HTML attribute. 2018-04-04 13:16:03 -04:00
Claude Paroz f3b69f9757 Fixed #29273 -- Prevented initial selection of empty choice in multiple choice widgets.
Regression in b52c73008a.
2018-04-02 08:52:53 -04:00
Mariusz Felisiak 362813d628
Fixed hanging indentation in various code. 2018-03-16 10:54:34 +01:00
Tim Graham 87dc0844a6 Fixed #29200 -- Fixed label rendering when using RadioSelect and CheckboxSelectMultiple with MultiWidget. 2018-03-15 09:10:23 -04:00