Commit Graph

479 Commits

Author SHA1 Message Date
Claude Paroz f3c43ad1fd Refs #23919 -- Removed python_2_unicode_compatible decorator usage 2017-01-18 13:44:34 +01:00
Claude Paroz d7b9aaa366 Refs #23919 -- Removed encoding preambles and future imports 2017-01-18 09:55:19 +01:00
Tim Graham 742d666da5 Refs #24219 -- Removed django.forms.extras per deprecation timeline. 2017-01-17 14:09:28 -05:00
Mariusz Felisiak 974d14534c Fixed #27723 -- Set MultiWidget's subwidgets input type from attrs argument.
Regression in b52c73008a.
2017-01-13 06:34:33 -05:00
Mariusz Felisiak 6872ce2266 Fixed #27712 -- Reallowed Input widget's attrs argument to set the input type.
Regression in b52c73008a.
2017-01-10 11:38:27 -05:00
Dmitry 12cefee5d8 Refs #15667 -- Prevented newlines in attrs.html widget rendering.
Removed the trailing newline from widget attrs.html template.
The solution may be revisited by fixing refs #9198 but not
for Django 1.11.

Thanks Dmitry Ivanchenko for the report and Preston Timmons for advice.
2017-01-06 19:11:32 -05:00
Tim Graham 4e89082f31 Refs #15667 -- Fixed form renderer test for Python 2 non-ASCII path. 2016-12-28 15:57:55 -05:00
Josef Rousek aaecf038ca Fixed #27370 -- Prevented Select widget from using 'required' with a non-empty first value. 2016-12-28 10:45:22 -05:00
Preston Timmons b52c73008a Fixed #15667 -- Added template-based widget rendering.
Thanks Carl Meyer and Tim Graham for contributing to the patch.
2016-12-27 17:50:10 -05:00
Illia Volochii 4a51ba228b Fixed #27642 -- Made forms.utils.flatatt() omit 'None' values from attrs. 2016-12-27 09:42:17 -05:00
Tim Graham b5f0b3478d Fixed #27579 -- Added aliases for Python 3's assertion names in SimpleTestCase. 2016-12-07 17:42:31 -05:00
Claude Paroz d49551bc26 Fixed #27119 -- Cached BaseFormSet.management_form property
Thanks Tim Graham for the review.
2016-12-01 20:17:25 +01:00
Diego Martín abd434059e Fixed #27250 -- Removed 'for ="..."' from CheckboxSelectMultiple's <label>. 2016-11-22 11:48:37 -05:00
Ramin Farajpour Cami 967be82443 Fixed E305 flake8 warnings. 2016-11-14 12:30:46 -05:00
Kenneth Veldman 8618a7eaa1 Fixed #27431 -- Prevented disabled form fields from appearing as changed. 2016-11-11 06:57:57 -05:00
za 321e94fa41 Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings. 2016-11-10 21:30:21 -05:00
Michal Petrucha 09da1e79de Fixed #27369 -- Prevented widgets from being shared between form field instances. 2016-11-06 07:16:56 +01:00
Tim Graham 87c5e7efeb Refs #27186 -- Fixed model form default fallback for CheckboxSelectMultiple. 2016-09-30 14:49:50 -04:00
Tim Graham 3507d4e773 Fixed #27186 -- Fixed model form default fallback for MultiWidget, FileInput, SplitDateTimeWidget, SelectDateWidget, and SplitArrayWidget.
Thanks Matt Westcott for the review.
2016-09-22 12:20:58 -04:00
Jon Dufresne 2c716c1dc7 Fixed #27256 -- Changed Select widget's selected attribute to use HTML5 boolean syntax. 2016-09-21 15:12:13 -07:00
Tim Graham 8119b679eb Refs #27025 -- Fixed "invalid escape sequence" warnings in Python 3.6.
http://bugs.python.org/issue27364
2016-09-17 15:44:06 -04:00
Tim Graham dab653cadc Organized forms_tests test_regressions.py. 2016-09-09 08:55:29 -04:00
Jon Dufresne f5c6d3c8d9 Fixed #27068 -- Unified form field initial data retrieval. 2016-08-18 17:55:47 -07:00
Jon Dufresne fab46ce6f5 Fixed #27037 -- Prevented required attribute on ClearableFileInput when initial data exists. 2016-08-12 13:59:01 -04:00
Tim Graham 176f27049e Updated an import per isort. 2016-08-10 15:27:31 -04:00
Andrew Nester f5c6295797 Fixed #26844 -- Made formset's validate_min validation ignore empty forms. 2016-08-10 13:03:04 -04:00
Marcin Nowak 74bb013cc1 Fixed #26905 -- Allowed using MultiValueDict-like objects as form data. 2016-08-09 19:46:24 -04:00
Claude Paroz 3569ba0333 Fixed #27015 -- Prevented HTML-invalid minlength/maxlength on hidden inputs 2016-08-06 10:22:17 +02:00
Jon Dufresne 50e299dbfb Fixed #26928 -- Changed forms' checked attribute to HTML5 boolean style. 2016-08-04 19:16:54 -04:00
Jon Dufresne ac3aaaa740 Fixed #26927 -- Made subwidget iteration pass disabled and required attributes. 2016-08-01 10:36:17 -04:00
Jon Dufresne caa006f327 Removed unnecessary coerce to list in forms_tests. 2016-07-22 07:46:45 -04:00
Dmitry Dygalo ca32979cdc
Made miscellaneous code cleanups 2016-07-21 10:08:19 -04:00
Priy a7b5dfd170 Fixed #26821 -- Fixed forms.Email/URLField crash on None value. 2016-07-14 12:59:14 -04:00
Jon Dufresne 76e19da5b0 Fixed #26890 -- Fixed IntegerField crash on Unicode numbers. 2016-07-14 09:38:57 -04:00
Tim Graham c9ae09addf Replaced use of TestCase.fail() with assertRaises().
Also removed try/except/fail antipattern that hides exceptions.
2016-06-28 11:21:26 -04:00
Jon Dufresne 4f336f6652 Fixed #26747 -- Used more specific assertions in the Django test suite. 2016-06-16 14:19:18 -04:00
Tim Graham 55c3133df8 Simplified a ClearableFileInput test. 2016-05-14 10:31:32 -04:00
Tim Graham 86573861a9 Refs #15667 -- Removed choices argument from some RendererMixin methods.
RendererMixin will soon be removed but this removal and the corresponding
test changes stand on their own.
2016-04-28 18:48:52 -04:00
David Sanders 218175b09d Fixed #26534 -- Fixed boolean form fields has_changed() with hidden input. 2016-04-24 15:06:30 -04:00
Tim Graham 859eeaa0f0 Fixed #26533 -- Renamed Widget._format_value() to format_value(). 2016-04-23 13:15:45 -04:00
Loïc Bistuer 6f5fcfc6d2 Moved declaration of test form inside the relevant test for clarity. 2016-04-22 09:38:47 +07:00
Loïc Bistuer a885bca1df Fixed #26528 -- Allowed any iterable (e.g. tuple) as validators kwarg for form/model fields. 2016-04-22 09:38:47 +07:00
Jon Dufresne ec6121693f Fixed #22383 -- Added support for HTML5 required attribute on required form fields. 2016-04-21 19:16:38 -04:00
Jon Dufresne 500e5a6886 Fixed #26516 -- Added minlength attribute when forms.CharField.min_length is set. 2016-04-19 08:54:27 -04:00
Tim Graham 3cb63b0e47 Refs #26502 -- Added choices to Form.__getitem__() KeyError message. 2016-04-14 09:15:09 -04:00
Berker Peksag 0247c9b08f Split form's test_fields.py into different files. 2016-04-11 12:48:23 -04:00
Tim Graham 92053acbb9 Fixed E128 flake8 warnings in tests/. 2016-04-08 10:12:33 -04:00
Tim Graham 2cd2d18851 Fixed W503 flake8 warnings. 2016-04-04 17:14:26 -04:00
Jon Dufresne e862296960 Removed duplicate definition of ChoiceFormSet. 2016-03-25 07:37:21 -04:00
Akshesh 44c0ecdd92 Fixed #25364 -- Added generic way to test on all browsers supported by selenium.
Browser names should be passed as a comma separated list to the --selenium flag.

Thanks Tim Graham, Simon Charette and Moritz Sichert for review and discussion.
2016-03-15 13:10:32 -04:00
Jon Dufresne b412681359 Fixed #26267 -- Fixed BoundField to reallow slices of subwidgets. 2016-02-24 07:02:51 -05:00
Berker Peksag 043383e3f3 Fixed #24727 -- Prevented ClearableFileInput from masking exceptions on Python 2 2016-02-15 22:51:46 +02:00
Alexey Kotlyarov b59f963ad2 Fixed #26212 -- Made forms.FileField and translation.lazy_number() picklable. 2016-02-15 11:44:29 -05:00
jpic 926e90132d Fixed #25731 -- Removed unused choices kwarg for Select.render() 2016-02-02 18:03:19 -05:00
Hasan 253adc2b8a Refs #26022 -- Used context manager version of assertRaisesMessage in tests. 2016-01-29 13:03:39 -05:00
Hasan 3d0dcd7f5a Refs #26022 -- Used context manager version of assertRaises in tests. 2016-01-29 12:32:18 -05:00
Tim Graham 04564eb74d Fixed #26129 -- Made invalid forms display initial values of disabled fields. 2016-01-28 18:43:48 -05:00
userimack 60586dd737 Fixed #26125 -- Fixed E731 flake warnings. 2016-01-25 14:23:43 -05:00
Alexander Gaevsky 956cde8004 Fixed #26104 -- Fixed TypeError when passing number to forms.DurationField. 2016-01-22 16:24:49 -05:00
Luke Plant 77974a684a Changed `action="."` to `action=""` in tests and docs.
`action="."` strips query parameters from the URL which is not usually what
you want. Copy-paste coding of these examples could lead to difficult to
track down bugs or even data loss if the query parameter was meant to alter
the scope of a form's POST request.
2016-01-21 13:59:15 -05:00
Marten Kenbeek 16411b8400 Fixed #26013 -- Moved django.core.urlresolvers to django.urls.
Thanks to Tim Graham for the review.
2015-12-31 14:21:29 -05:00
Raphaël Hertzog e0f370364a Fixed #26017 -- Removed a dependency on the name of the top-level tests directory. 2015-12-30 12:50:21 -05:00
Claude Paroz d91cc25a2a Fixed #25942 -- Fixed TypedChoiceField.has_changed with nullable field
This fixes a regression introduced by 871440361.
2015-12-17 15:38:19 +01:00
Josh Soref 93452a70e8 Fixed many spelling mistakes in code, comments, and docs. 2015-12-03 12:48:24 -05:00
Marti Raudsepp 1155843a41 Fixed #25683 -- Allowed ModelChoiceField(queryset=...) to accept Managers.
This fixes a regression from refs #25496.
2015-11-09 12:42:36 -05:00
Tim Graham 9c5e272860 Fixed #25550 -- Deprecated direct assignment to the reverse side of a related set. 2015-10-27 07:57:15 -04:00
Claude Paroz f59a0401e5 Fixed #25567 -- Removed obsolete MEDIA_URL fallback in Media.absolute_path 2015-10-19 15:39:35 +02:00
Tim Graham a3fe4addcb Refs #23162 -- Removed forms.Field._has_changed() method.
Per deprecation timeline.
2015-09-23 19:31:10 -04:00
Tim Graham b6ea1961eb Refs #23151 -- Removed RegexField.error_message per deprecation timeline. 2015-09-23 19:31:10 -04:00
Tim Graham 7cb3a48843 Fixed #25410 -- Fixed empty ClearableFileInput crash on Python 2.
Reverted "Fixes #24727 -- Prevented ClearableFileInput from masking
exceptions on Python 2" and added a regression test.

This reverts commit 5c412dd8a7.
2015-09-23 10:26:19 -04:00
Moritz Sichert 8550161e53 Refs #25294 -- Moved BoundField to django.forms.boundfield. 2015-09-16 14:43:38 -04:00
Moritz Sichert 535809e121 Fixed #25294 -- Allowed custom BoundFields on forms. 2015-09-16 10:18:07 -04:00
Dražen Odobašić b1e33ceced Fixed #23395 -- Limited line lengths to 119 characters. 2015-09-12 11:40:50 -04:00
Moritz Sichert dae81c6ec6 Refs #25300 -- Fixed reference to TextInput in a test. 2015-09-09 09:28:48 -04:00
Preston Timmons 4c30fa905d Rewrote form widget tests as proper unittests.
This is preparation for landing the template-based widget rendering
patch and goes a long way to making these tests more useful for future
development. The old doctest heritage is strong here.
2015-08-31 23:03:55 -05:00
Maxime Lorant 5153a3bfdc Fixed #25331 -- Removed trailing blank lines in docstrings. 2015-08-31 17:37:21 -04:00
Maxime Lorant 7d60659e22 Fixed #25300 -- Added unit tests for BoundField.id_for_label 2015-08-22 10:08:59 -04:00
Flavio Curella c2e70f0265 Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField 2015-07-27 18:28:13 -04:00
Tim Graham b60375d4bb Fixed #25129 -- Made model instance defaults work with migrations (refs #24919). 2015-07-21 09:19:40 -04:00
Tim Graham 04e69598de Refs #24919 -- Made test models serializable for migrations. 2015-07-21 09:19:40 -04:00
Edward Henderson f8cc464452 Fixed #16501 -- Added an allow_unicode parameter to SlugField.
Thanks Flavio Curella and Berker Peksag for the initial patch.
2015-07-17 13:48:58 -04:00
Claude Paroz 1ef4aeab40 Fixed #25078 -- Added support for disabled form fields
Thanks Keryn Knight and Tim Graham for the reviews.
2015-07-16 19:36:56 +02:00
Tim Graham b356dc4e07 Refs #25085 -- Used more specific assertion in widget test. 2015-07-14 12:17:34 -04:00
Eric Carrillo 8ee6a3f1a8 Fixed #25085 -- Overrode Select widget's __deepcopy__() 2015-07-14 11:56:08 -04:00
Yosuke Yasuda a2b999dfca Fixed #25108 -- Fixed a test which failed on Pillow 2.9+ 2015-07-13 14:58:44 -04:00
Tim Graham e7c6a2cf9f Refs #4960 -- Fixed selenium test failures for CharField strip changes. 2015-07-06 08:52:50 -04:00
Curtis 11cac1bd8e Fixed #4960 -- Added "strip" option to CharField 2015-07-01 17:47:05 -04:00
Tim Graham aaacaeb096 Renamed RemovedInDjangoXYWarnings for new roadmap.
Forwardport of ae1d663b79
from stable/1.8.x plus more.
2015-06-24 16:08:20 -04:00
Andriy Sokolovskiy cf6ce279c7 Fixed #24948 -- Fixed crash when uploading bitmap images in forms.ImageField 2015-06-16 14:37:58 -04:00
Markus Amalthea Magnuson 1884bf8e8e Fixed #12437 -- Added css_classes to Form._html_output() 2015-06-06 19:23:06 -04:00
Sergei Maertens 238e2ac369 Fixed #18166 -- Added form_kwargs support to formsets.
By specifying form_kwargs when instantiating the formset, or overriding
the `get_form_kwargs` method on a formset class, you can pass extra
keyword arguments to the underlying `Form` instances.

Includes tests and documentation update.
2015-06-04 15:13:55 +02:00
Paweł Marczewski 4df7e8483b Fixed #24788 -- Allowed Forms to specify a prefix at the class level. 2015-05-25 20:23:31 -04:00
Claude Paroz 97e1160be5 Refs #9230 -- Added complementary tests for widget iterations 2015-05-22 09:25:37 +02:00
Simon Charette be67400b47 Refs #24652 -- Used SimpleTestCase where appropriate. 2015-05-20 13:46:13 -04:00
wdmgsm 4dcc649341 Fixed #24497 -- Added Widget.supports_microseconds attribute 2015-05-06 07:13:00 -04:00
Antonio Garcia-Dominguez 5c412dd8a7 Fixes #24727 -- Prevented ClearableFileInput from masking exceptions on Python 2 2015-05-04 09:44:18 -04:00
Alasdair Nicol eaeea6f947 Fixed #24714 -- Used more specific assertions than assertEqual in tests. 2015-04-28 09:31:04 -04:00
Alasdair Nicol d91321e8be Used assertIsInstance in tests. 2015-04-27 08:40:36 -04:00
Claude Paroz 2112b7d789 Adapted form regression test to new translations 2015-04-01 19:51:50 +02:00
Moritz Sichert 1f2abf784a Fixed #24469 -- Refined escaping of Django's form elements in non-Django templates. 2015-03-27 19:46:20 -04:00
Thomas Tanner 28986da4ca Fixed #5986 -- Added ability to customize order of Form fields 2015-03-16 09:12:57 -04:00
Claude Paroz 8714403614 Fixed #24428 -- Fixed has_changed for fields with coercion
Thanks Carsten Fuchs for the report.
2015-03-05 09:00:13 +01:00
Claude Paroz 4b8979e477 Fixed #17401 -- Made SelectDateWidget.render reflect wrong value
Thanks Marcin Wrobel for the initial patch.
2015-03-01 21:37:52 +01:00
Claude Paroz 8a9f39d2b3 Removed binary input test line
That line was inconveniently introduced by the committer (me) in
3b966c2b73. Sorry!
2015-02-27 15:44:06 +01:00
Jon Dufresne 3b966c2b73 Fixed #24229 -- Changed IntegerField to clean floats representing integers 2015-02-27 12:23:21 +01:00
Michael Angeletti 65441bbdb0 Fixed #24391 -- Made BoundField.value() cache callable values. 2015-02-24 19:50:55 -05:00
Aymeric Augustin 934400759d Guaranteed removal of temporary files during tests.
Dropped the DJANGO_TEST_TEMP_DIR environment variable.

Before this change, proper removal depended on the developer passing
dir=os.environ['DJANGO_TEST_TMP_DIR'] to tempfile functions.
2015-02-23 16:55:26 +01:00
Michael Angeletti 49647bec6e Added missing return value to DurationField.prepare_value(); refs #24339. 2015-02-14 18:38:50 -05:00
Michael Angeletti 8a21d25033 Fixed #24339 -- Fixed crash with empty DurationField form field. 2015-02-14 07:37:18 -05:00
Claude Paroz 58afd30b59 Tested DecimalField with scientific notation
Refs #15775.
2015-02-06 22:30:50 +01:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
darkryder 9ec8aa5e5d Fixed #24149 -- Normalized tuple settings to lists. 2015-02-03 14:59:45 -05:00
Tim Graham cd91486213 Fixed flake8 warning. 2015-01-28 07:00:52 -05:00
Loic Bistuer 728b6fd9ca Fixed #24219 -- Moved SelectDateWidget together with the other widgets
and deprecated django.forms.extras.

Thanks Berker Peksag and Tim Graham for the reviews.
2015-01-27 22:40:02 +07:00
Loic Bistuer 3a4c9e1b43 Cleaned up some forms tests.
Thanks Berker Peksag and Tim Graham for the reviews. Refs #24219.
2015-01-27 22:39:57 +07:00
Adam Taylor 039465a6a7 Fixed typos in code comments. 2015-01-20 12:18:03 -05:00
Tim Graham 33457cd3b0 Removed IPAddressField per deprecation timeline; refs #20439. 2015-01-19 11:12:57 -05:00
Tim Graham 714277cb4c Removed support for SplitDateTimeWidget with DateTimeField per deprecation timeline.
refs #8898
2015-01-17 18:49:44 -05:00
Tim Graham 37b7776a01 Removed django.utils.datastructures.MergeDict per deprecation timeline; refs #18659. 2015-01-17 08:13:36 -05:00
Tim Graham 9ce36512fa Removed backwards compatibility shims for "util" modules per deprecation timeline.
refs #17627.
2015-01-17 07:40:12 -05:00
Yang Liu 3f9ec12d9c Fixed #23712 -- Fixed KeyError with BaseForm._html_output() 2015-01-15 20:19:53 -05:00
Danilo Bargen 2e65d56156 Fixed #20003 -- Improved and extended URLValidator
This adds support for authentication data (`user:password`) in URLs,
IPv6 addresses, and unicode domains.

The test suite has been improved by adding test URLs from
http://mathiasbynens.be/demo/url-regex (with a few adjustments,
like allowing local and reserved IPs).

The previous URL validation regex failed this test suite on 13
occasions, the validator was updated based on
https://gist.github.com/dperini/729294.
2015-01-06 14:04:25 -05:00
Tim Graham 40a8504357 Fixed #23891 -- Moved deprecation of IPAddressField to system check framework.
Thanks Markus Holtermann for review.
2015-01-01 13:30:52 -05:00
Andrey Maslov 7a878ca5cb Fixed #24008 -- Fixed ValidationError crash with list of dicts. 2014-12-31 14:43:13 -05:00
Tim Graham 8a9b0c15a6 Renamed tests for util -> utils moves; refs #17627. 2014-12-31 11:26:27 -05:00
Claude Paroz 51890ce889 Applied ignore_warnings to Django tests 2014-12-30 18:16:25 +01:00
Marc Tamlyn 57554442fe Fixed #2443 -- Added DurationField.
A field for storing periods of time - modeled in Python by timedelta. It
is stored in the native interval data type on PostgreSQL and as a bigint
of microseconds on other backends.

Also includes significant changes to the internals of time related maths
in expressions, including the removal of DateModifierNode.

Thanks to Tim and Josh in particular for reviews.
2014-12-20 18:28:29 +00:00
Grzegorz Slusarek 0dea81cd6d Fixed #23674 -- Fixed a crash when a MultiValueField has invalid data. 2014-12-12 08:47:21 -05:00
Berker Peksag 560b4207b1 Removed redundant numbered parameters from str.format().
Since Python 2.7 and 3.1, "{0} {1}" is equivalent to "{} {}".
2014-12-03 14:27:38 -05:00
Tim Heap 5b17dcd8ef Fixed #23883 -- Stopped flatatt modifying its argument 2014-11-21 09:45:08 +01:00
Aymeric Augustin b69b4008d1 Removed usage of a global variable. 2014-11-19 21:35:40 +01:00
Peter Inglesby 74e1980cf9 Fixed #13181 -- Added support for callable choices to forms.ChoiceField
Thanks vanschelven and expleo for the initial patch.
2014-11-04 11:23:58 -05:00
Berker Peksag f7969b0920 Fixed #23620 -- Used more specific assertions in the Django test suite. 2014-11-03 11:56:37 -05:00
Loic Bistuer ec2fd02bb3 Fixed #23594 -- Fixed deepcopy on ErrorList.
Thanks Troy Grosfield for the report and Tim Graham for the tests.
2014-10-07 00:09:55 +07:00
Marc Tamlyn ed7821231b Fixed #19463 -- Added UUIDField
Uses native support in postgres, and char(32) on other backends.
2014-09-16 10:08:09 +01:00
Vlastimil Zíma e622caaa85 Fixed #21201 -- Improved customization of ClearableFileInput. 2014-08-29 09:40:08 -04:00
Tim Graham f9c7732e96 Tweaked docstrings from previous commit. 2014-08-22 15:57:15 -04:00
areski a6691e5dcf Fixed #23167 -- Added BaseForm.__repr__()
Thanks Keryn Knight for the idea.
2014-08-22 15:55:56 -04:00
Gabriel Muñumel deed00c0d8 Fixed #23162 -- Renamed forms.Field._has_changed() to has_changed(). 2014-08-15 08:14:45 -04:00
Tim Graham 6e77acc589 Fixed flake8 warning. 2014-08-03 14:21:45 -04:00
Tim Graham 0f2ceee025 Fixed #23151 -- Deprecated RegexField.error_message.
Thanks Baptiste Mispelon for the suggestion.
2014-08-03 11:21:01 -04:00
Petras Zdanavičius 8b7347220f Fixed #23103 -- Annotated ImageField file with image and content_type attributes.
Thanks Jeremy Dunck for the suggestion and Nick Sanford for review.
2014-08-01 09:30:58 -04:00
Kit La Touche 17e75d03f9 Fixed #23129 -- Added 'true' and 'false' to `NullBooleanField`.
JavaScript serializations of forms will sometimes render the boolean
values as the strings 'true' and 'false', in lower case. Rather than
repeat boilerplate in the JavaScript to circumvent this, it seems
reasonable to allow Django to understand the lower-case versions of the
booleans.
2014-07-29 19:55:55 -04:00
Simon Charette 80708ac772 Fixed #23113 -- ChoiceInput.render should take specified attrs into account.
Thanks to Tim Graham for the review.
2014-07-28 10:01:07 -04:00
Anubhav Joshi 5cdb8f8c1e Fixed #16617 -- Added 'value' to BaseValidator params.
Also allowed overriding the default messages in subclasses of BaseValidator.

Thanks sperrygrove for initial patch.
2014-07-26 10:03:00 -04:00
Anubhav Joshi 011abb7d96 Fixed #19671 -- Added warnings that null and validators are ignored for ManyToManyField.
Thanks Loic Bistuer and Tim Graham for help and review.
2014-07-09 16:01:09 -04:00
Claude Paroz dd9a23d5cf Fixed #22950 -- Eased markup customization for choice field rendering
Thanks Patrick Robertson for the report.
2014-07-05 13:36:49 +02:00
Claude Paroz 9209049211 Ensured bound field renders as unicode safe data
Refs #22950.
2014-07-05 11:42:27 +02:00
Loic Bistuer 1966054feb Fixed #22915 -- Document backward incompatible changes in the ValidationError constructor.
This patch also fixes update_error_dict to better handle the use case described
in this ticket, previously the type of the provided container could be lost in
some conditions.

Thanks Russell Keith-Magee for the report and Tim Graham for review.
2014-07-04 17:05:31 +07:00
gyx1000 7e2c87809c Fixed #22684 -- Amended SelectDateWidget.empty_label to accept a tuple of values.
Thanks danielsamuels for the report
2014-06-04 07:23:25 -04:00
Nick Presta 11f0899bbe Fixed #11776 -- Added CSS class for non-field/top of form errors.
Thanks Daniel Pope for the suggestion.
2014-06-02 15:22:15 -04:00
Alex Gaynor 1dcc603eff Fixed several typos in Django 2014-05-28 17:39:14 -07:00
Guillaume Pannatier 32586b0ba4 Fixed #22684 -- Added `empty_label` option on `django.forms.extras.widets.SelectDateWidget`
Thanks danielsamuels for the report
2014-05-28 13:23:28 -04:00
Florian Apolloner ee51ab9d23 Restored Python 2 compatibility. 2014-05-26 00:07:15 +02:00
Florian Apolloner 536ebaa048 Fixed a few warnings in the testsuite. 2014-05-25 23:14:50 +02:00
Stephen Burrows d64f192df1 Fixed #22628 -- Took initial forms into account when combining FormSet.min_num and FormSet.extra.
Forwardport of 79f15ab1ef from stable/1.7.x
2014-05-16 06:38:24 -04:00
Julen Ruiz Aizpuru 5eb81ce445 Fixed #22533 -- Added label_suffix parameter to form fields.
Fields can now receive the `label_suffix` attribute, which will override
a form's `label_suffix`.

This enhances the possibility to customize form's `label_suffix`, allowing
to use such customizations while using shortcuts such as
`{{ form.as_p }}`.

Note that the field's own customization can be overridden at runtime by
using the `label_prefix` parameter to `BoundField.label_tag()`.

Refs #18134.
2014-05-13 09:09:33 -04:00
Stephen Burrows a5de0df58b Fixed #22502 -- Fixed microseconds/default/form interaction
Made explicit lack of microsecond handling by built-in datetime form
fields. Used that explicitness to appropriately nix microsecond
values in bound fields. Thanks Claude Paroz for the review.
2014-05-10 10:56:39 +02:00
Ben Davis df60db0e78 Fixed #22570 -- Made Form.__getitem__ KeyError more descriptive. 2014-05-05 20:01:15 -04:00
chriscauley 66ec9ee441 Fixed #22378 -- Updated \d to [0-9]+ in urlpatterns of docs and tests.
Thanks tomwys for the suggestion.
2014-04-16 20:36:29 -04:00
Aymeric Augustin 2791fbf59d Used more specific test assertions. 2014-04-09 22:20:22 +02:00
Anubhav Joshi cd914e31c9 Fixed #21977 -- Deprecated SimpleTestCase.urls 2014-04-06 17:33:43 -04:00
Tim Graham d73d0e071c Fixed #22218 -- Deprecated django.conf.urls.patterns.
Thanks Carl Meyer for the suggestion and Alex Gaynor and Carl for reviews.
2014-04-03 07:28:10 -04:00
Alex Gaynor 778ce245dd Corrected many style guide violations that the newest version of flake8 catches 2014-03-30 12:11:05 -07:00
Claude Paroz d320863878 Fixed #22114 -- Stopped adding trailing slashes in URLField.to_python
Thanks coredumperror at gmail.com for the report and Tim Graham
for the review.
2014-03-26 18:10:58 +01:00
Anubhav Joshi 416a858023 Fixed #17922 -- Added required_css_class to form label.
Thanks hanson2010 for the suggestion.
2014-03-24 08:11:54 -04:00
Loic Bistuer 7ac8380799 Fixed #22318 -- Added Form.has_error() to easily check if a given error has happened. 2014-03-24 07:21:32 -04:00
Loic Bistuer e61d99d96d Fixed #20684 -- Added support for HTML5 boolean attributes to form widgets. 2014-03-22 14:28:12 -04:00
Tim Graham e80de93af6 Removed hard-coded help_text for ManyToManyFields that use a SelectMultiple widget
Per deprecation timeline; refs #9321.
2014-03-21 19:10:07 -04:00
Tim Graham 35f46ec7a9 Fixed flake8 warnings. 2014-03-21 06:24:45 -04:00
Dejan Noveski 4d0c5f6142 Fixed #22255 -- Added support for specifying re flags in RegexValidator 2014-03-21 11:12:36 +01:00
Claude Paroz 5a976b4bec Fixed #22245 -- Avoided widget overwrite in forms.IntegerField subclasses
Thanks Jeroen Pulles for the report and Simon Charette for the review.
2014-03-13 16:58:14 +01:00
Claude Paroz 210d0489c5 Fixed #21188 -- Introduced subclasses for to-be-removed-in-django-XX warnings
Thanks Anssi Kääriäinen for the idea and Simon Charette for the
review.
2014-03-08 09:57:40 +01:00
Chris Wilson 95c74b9d69 Fixed #22206 -- Passed models.TextField.max_length to forms.CharField.maxlength 2014-03-05 20:09:28 +01:00
Rodolfo Carvalho 0d91225892 Fixed many typos in comments and docstrings.
Thanks Piotr Kasprzyk for help with the patch.
2014-03-03 07:38:09 -05:00
vvojvoda c23b3717be Fixed #21962 -- Added escape_html flag to ErrorDict.as_json() 2014-02-28 07:05:55 -05:00
Claude Paroz cb844497d0 Fixed #22097 -- Fixed change detection for TypedChoiceField
Thanks Igor Mitrenko for the report.
2014-02-20 13:40:42 +01:00
Aymeric Augustin b951a7fbc1 Removed superfluous uses of TransRealMixin.
The translation.override context manager cleans up after itself. As a
consequence this mixin isn't needed any more in many cases.
2014-01-27 22:01:22 +01:00
Claude Paroz 0179852d7f Fixed #8898 -- Obsoleted SplitDateTimeWidget usage with DateTimeField
Thanks Tim Graham for the review.
2014-01-11 15:50:34 +01:00
Claude Paroz 18374c1d8c Fixed #21752 -- Prevented custom widget step attribute to be overwritten
Thanks orcein at gmail.com for the report.
2014-01-11 14:08:04 +01:00
Aymeric Augustin f5f7617167 Renamed a couple models to prevent duplicate names. 2014-01-05 20:52:46 +01:00
Aymeric Augustin e32095616c Imported override_settings from its new location. 2013-12-23 21:37:56 +01:00
Loic Bistuer 2fd7fc134c Refs #17413 -- Added isinstance backward compatibility on ErrorList. 2013-12-18 08:59:53 -05:00
Loic Bistuer 3ce9829b61 Fixed #17413 -- Serialization of form errors along with all metadata. 2013-12-16 16:33:28 -05:00
Loic Bistuer f563c339ca Fixed #20867 -- Added the Form.add_error() method.
Refs #20199 #16986.

Thanks @akaariai, @bmispelon, @mjtamlyn, @timgraham for the reviews.
2013-11-30 01:00:53 +07:00
Claude Paroz a0f3eeccf3 Fixed #21397 -- Re-added flexibility to TypedChoiceField coercion
Thanks Elec for the report and Simon Charette for the review.
2013-11-18 18:24:56 +01:00
Claude Paroz bc21e9c0d9 Fixed #13970 -- Made SelectDateWidget use the standard widget is_required attribute
Thanks mitar for the report and Tim Graham for the review.
2013-11-08 16:58:17 +01:00
Alex Gaynor f67e18f39e Fixed all E251 violations 2013-11-03 10:17:58 -08:00
Alex Gaynor c347f78cc1 Fixed all E226 violations 2013-11-03 10:08:55 -08:00
Jason Myers 7a61c68c50 PEP8 cleanup
Signed-off-by: Jason Myers <jason@jasonamyers.com>
2013-11-02 23:50:49 -05:00
coagulant 8eec2d93b6 Fixed all E261 warnings 2013-11-02 23:50:33 -05:00
Tim Graham 36ded01527 Fixed #21302 -- Fixed unused imports and import *. 2013-11-02 15:24:56 -04:00
Alex Gaynor b35ff0d920 Fixed all the E203 violations 2013-10-26 18:27:42 -07:00
Alex Gaynor 9d740eb8b1 Fix all violators of E231 2013-10-26 12:15:03 -07:00
Alasdair Nicol c3aa2948c6 Fixed #21298 -- Fixed E301 pep8 warnings 2013-10-23 13:45:03 +01:00
Tim Graham ae48d77ef8 Fixed E225 pep8 warnings. 2013-10-23 06:09:29 -04:00
Ramiro Morales 51d2e1fb23 Fixed #21307 -- Moved TransRealMixin to django.test.utils. 2013-10-22 22:19:56 -03:00
Tim Graham 8e2029f8dd Removed import * in tests.
Thanks to flake8 path/to/file.py | awk -F ' ' '{ print $5 }' | sort | uniq
2013-10-22 08:32:01 -04:00
Alasdair Nicol b289fcf1bf Fixed #21288 -- Fixed E126 pep8 warnings 2013-10-21 08:31:30 -04:00
Tim Graham 96d1d4e292 Removed unused local variables in tests. 2013-10-19 08:31:38 -04:00
Alasdair Nicol a800036981 Fixed #21287 -- Fixed E123 pep8 warnings 2013-10-18 10:07:39 +01:00
Alasdair Nicol bab9123daa Fixed #21268 -- Fixed E303 pep8 warnings 2013-10-18 01:46:24 +01:00
Alasdair Nicol dfb4cb9970 Fixed #21285 -- Fixed E121,E122 pep8 warnings 2013-10-17 20:20:11 -04:00
Bouke Haarsma 2fb5a51fa3 Fixed #18659 -- Deprecated request.REQUEST and MergeDict
Thanks Aymeric Augustin for the suggestion.
2013-10-17 09:42:28 -04:00
Alasdair Nicol eb214452c3 Fixed #21270 -- Fixed E701 pep8 warnings 2013-10-17 12:12:40 +01:00
Marc Tamlyn ce823d3710 Merge pull request #1382 from loic/ticket19617
Fixed #19617 -- Refactored form metaclasses to support more inheritance scenarios.
2013-10-15 04:22:34 -07:00
Larry O'Neill 83b9bfea44 Fixed #21266 -- Fixed E201,E202 pep8 warnings. 2013-10-14 18:12:00 -04:00
Loic Bistuer ac5ec7b8bc Fixed #19617 -- Refactored Form metaclasses to support more inheritance scenarios.
Thanks apollo13, funkybob and mjtamlyn for the reviews.
2013-10-14 21:59:30 +07:00
Claude Paroz 00a73c1c69 Fixed #21173 -- Stopped fixing format for date-based widgets at init time
Thanks Marc Tamlyn for the review.
2013-10-12 18:31:19 +02:00
Tim Graham b67ab75e82 Fixed assorted flake8 errors. 2013-10-11 07:25:14 -04:00
Tim Graham adedc31072 Fixed "redefinition of unused 'foo' from line X" pyflakes warnings. 2013-10-10 11:09:42 -04:00
Tim Graham ff9e8eccf8 Removed unnecessary semicolons. 2013-10-10 08:50:32 -04:00
Christopher Babiak a834bc84d8 Fixed #20931 -- Fixed select widgets nested choice rendering
ChoiceFieldRenderer was not rendering nested choices. Added recursion
to ChoiceFieldRenderer to take nested choices and render them as
<ul>'s.
2013-09-28 17:25:32 -07:00
Erik Romijn 1a63092981 Fixed #20439 -- Started deprecation of IPAddressField 2013-09-28 10:55:32 +02:00
yokomizor df27803a55 Fixed #9532 -- Added min_num and validate_min on formsets.
Thanks gsf for the suggestion.
2013-09-19 13:11:49 -04:00
Tim Graham 1234225068 Fixed test failures introduced in previous commit. 2013-09-16 13:12:50 -04:00
Tim Graham 18ffdb1772 Fixed #17627 -- Renamed util.py files to utils.py
Thanks PaulM for the suggestion and Luke Granger-Brown and
Wiktor Kołodziej for the initial patch.
2013-09-16 12:52:05 -04:00
Tim Graham 4e96dac450 Fixed #19298 -- Added MultiValueField.__deepcopy__
Thanks nick.phillips at otago.ac.nz for the report.
2013-09-10 13:56:49 -04:00
Florian Apolloner d5d0e03ec8 Fixed test errors from 053de6131a on py3.2. 2013-09-10 19:17:01 +02:00
e0ne 053de6131a Fixed #5749 -- Added field_name as a key in the _html_output dict
Thanks SmileyChris for the suggestion.
2013-09-10 13:00:10 -04:00
Florian Apolloner df2fd4e09b Removed unneeded imports in tests's __init__.py and unified them. 2013-09-09 23:01:07 +02:00
Daniel Langer cc957cb16c Fixed #4287 -- Fixed NaN and +/- Infinity handling in FloatField
NaN, +Inf, and -Inf are no longer valid values for FloatFields.
2013-09-06 14:56:37 -04:00
Tim Graham 5649c0af9d Fixed "indentation is not a multiple of four" pep8 issues. 2013-09-03 14:22:21 -04:00
Simon Charette 11cd7388f7 Fixed #20989 -- Removed useless explicit list comprehensions. 2013-08-30 10:57:51 -04:00
Loic Bistuer da800be6dd Fixed #20986 -- Enabled SelectDateWidget to use custom months
Reviewed by Trac alias MarkusH.
2013-08-28 16:39:26 +03:00
Claude Paroz 165f44aaaa Combine consecutive with statements
Python 2.7 allows to combine several 'with' instructions.
2013-08-16 20:12:10 +02:00
Matt Johnson 907ef9d0d1 Fixed #20555 -- Make subwidget id attribute available
In `BoundField.__iter__`, the widget's id attribute is now passed to
each subwidget. A new id_for_label property was added to ChoiceInput.
2013-08-13 13:23:05 -04:00
Marc Tamlyn 1c4a9bd9ad Revert change to the default Form.clean()
This means it doesn't break for people who are doing
`cleaned_data = super(FooForm, self).clean()`.
2013-08-08 14:27:48 +01:00
Marc Tamlyn fb1dd6b13a Form.clean() does not need to return cleaned_data.
If it does, that will be used as the cleaned_data. The default
implementation has been changed to match this change.
2013-08-08 14:05:55 +01:00
Tai Lee 1280675834 Fixed #15511 -- Allow optional fields on ``MultiValueField` subclasses.
The `MultiValueField` class gets a new ``require_all_fields`` argument that
defaults to ``True``. If set to ``False``, individual fields can be made
optional, and a new ``incomplete`` validation error will be raised if any
required fields have empty values.

The ``incomplete`` error message can be defined on a `MultiValueField`
subclass or on each individual field. Skip duplicate errors.
2013-08-06 08:50:47 -04:00
Tim Heap 75c87e2d38 Fixed #20850 -- Added MultiWidget.needs_multipart_form 2013-08-05 10:02:28 -04:00
Alex Couper 1123f45511 Fixed #20649 -- Allowed blank field display to be defined in the initial list of choices. 2013-07-31 14:12:03 -04:00
Claude Paroz 5c1143910e Removed most of absolute_import imports
Should be unneeded with Python 2.7 and up.
Added some unicode_literals along the way.
2013-07-29 20:28:13 +02:00
Julien Phalip 47c755327b Fixed a number of minor misspellings. 2013-07-27 18:46:03 -07:00
Tim Graham 8676318d2d Fixed #20805 -- Removed an extra colon beside checkboxes in the admin.
Thanks CollinAnderson for the report.
2013-07-26 14:45:38 -04:00
Claude Paroz 02b0106d43 Fixed #20781 -- Fixed _has_changed regression with MultiValueField
Thanks Tim Graham for the report.
2013-07-22 09:06:07 +02:00
Simon Charette 415a36947c Fixed #20765 -- Set small values of `step` using exponential notation.
Browsers parse small factors of 10 as 0 under decimal notation.

Thanks to Trac alias matklad for the report and Claude Paroz for the review.
2013-07-19 23:31:15 -04:00
Tim Graham 9b471a8fe3 Fixed a deprecation warning in a selenium test. 2013-07-13 13:15:28 -04:00
Aymeric Augustin cfcf4b3605 Stopped using django.utils.unittest in the test suite.
Refs #20680.
2013-07-01 14:29:33 +02:00
Claude Paroz ef79582e86 Fixed 17478 -- Allowed queryset overriding in BaseModelFormSet init
BaseModelFormSet.forms is now a cached property instead of being
populated in the __init__ method. This behaviour also matches an
example in the documentation.
Thanks Thomasz Swiderski for the report and Simon Charette for the
review.
2013-06-22 09:29:37 +02:00
Simon Charette 04628e2016 Fixed #20630 -- Removed `maxlength` attribute from `NumberInput`.
This attribute is only allowed on inputs of type "text", "search", "url",
"tel", "email", or "password".

Thanks to yoyoma for the report and @bmispelon for the review.
2013-06-20 10:59:41 -04:00
Baptiste Mispelon 3128f3d38d Fixed #20618 -- Fixed regression in `BoundField.label_tag`. 2013-06-18 17:49:53 +02:00
Baptiste Mispelon 1b7634a0d0 Fixed #20464 -- Added a `total_error_count` method on formsets.
Thanks to frog32 for the report and to Tim Graham for the review.
2013-06-16 15:49:30 -04:00
Marc Tamlyn 46789e76c6 Fixed #20548 -- Removed all PendingDeprecationWarnings from django test suite 2013-06-14 15:37:39 +01:00
Gabe Jackson 584bd14dcf Fixed #18134 -- BoundField.label_tag now includes the form's label_suffix
There was an inconsistency between how the label_tag for forms were
generated depending on which method was used: as_p, as_ul and as_table
contained code to append the label_suffix where as label_tag called on a
form field directly did NOT append the label_suffix. The code for
appending the label_suffix has been moved in to the label_tag code of
the field and the HTML generation code for as_p, as_ul and as_table now
calls this code as well.

This is a backwards incompatible change because users who have added the
label_suffix manually in their templates may now get double label_suffix
characters in their forms.
2013-06-10 14:23:15 -04:00
Aymeric Augustin dfcce4288a Fixed available_apps for selenium tests.
Refs #20483.
2013-06-10 12:11:46 +02:00
Stephen Burrows e2518fdf46 Fixed #12337 - Honor ModelForm.Meta.exclude when saving ManyToManyFields.
Thanks margieroginski for the report.
2013-06-06 10:01:48 -04:00
Claude Paroz b67f2ac8e6 Fixed #20502 (again) -- More i18n cache flush in tests
Thanks Timo Graham for noticing the failures.
2013-06-06 14:28:58 +02:00
Ramiro Morales 0fa8d43e74 Replaced `and...or...` constructs with PEP 308 conditional expressions. 2013-05-26 23:47:50 -03:00
Claude Paroz be0bab1bb8 Fixed #11725 -- Made possible to create widget label tag without "for"
Thanks Denis Martinez for the report and initial patch, and
Sergey Kolosov for bringing the patch up to date.
2013-05-25 15:31:07 +02:00