Commit Graph

685 Commits

Author SHA1 Message Date
haxoza 375e1cfe2b Fixed #25349 -- Allowed a ModelForm to unset a fields with blank=True, required=False. 2016-02-19 14:18:53 -05:00
Berker Peksag 043383e3f3 Fixed #24727 -- Prevented ClearableFileInput from masking exceptions on Python 2 2016-02-15 22:51:46 +02:00
jpic 926e90132d Fixed #25731 -- Removed unused choices kwarg for Select.render() 2016-02-02 18:03:19 -05:00
Tim Graham 04564eb74d Fixed #26129 -- Made invalid forms display initial values of disabled fields. 2016-01-28 18:43:48 -05:00
jpic 65c13f9675 Refs #25731 -- Removed unused MultipleHiddenInput choices 2016-01-25 10:20:58 -05:00
Tim Graham 6b258befc2 Refs #26104 -- Replaced unnecessary force_str() with force_text(). 2016-01-23 13:40:18 -05:00
Alexander Gaevsky 956cde8004 Fixed #26104 -- Fixed TypeError when passing number to forms.DurationField. 2016-01-22 16:24:49 -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
Johannes Hoppe cf546e11ac Fixed #21221 -- Made form Media and static template tag use staticfiles if installed. 2015-12-10 14:30:19 -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
Claude Paroz f59a0401e5 Fixed #25567 -- Removed obsolete MEDIA_URL fallback in Media.absolute_path 2015-10-19 15:39:35 +02:00
Tim Graham 6afa6818fc Fixed #25496 -- Made ModelChoiceField respect prefetch_related(). 2015-10-05 18:21:56 -04:00
Moritz Sichert a51070e743 Refs #25294 -- Added BoundField import for backwards compatibility. 2015-09-24 19:57:19 +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
Claude Paroz 65a1055a36 Fixed #25431 -- Readded inline foreign keys to modelformset instances
Too much field exclusions in form's construct_instance() in _post_clean()
could lead to some unexpected missing ForeignKey values.
Fixes a regression from 45e049937. Refs #13776.
2015-09-21 21:30:49 +02:00
Iulia Chiriac 75ed590032 Fixed #24636 -- Added model field validation for decimal places and max digits. 2015-09-18 14:30:20 -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
Kholid Fuadi b8b776aabe Fixed typo in django/forms/utils.py docstring. 2015-09-14 08:49:15 -04:00
Dražen Odobašić b1e33ceced Fixed #23395 -- Limited line lengths to 119 characters. 2015-09-12 11:40:50 -04:00
Keryn Knight 3c5862ccb0 Fixed #24706 -- Made ModelForm._post_clean() handle a ValidationError raised when constructing the model instance.
Thanks Loïc Bistuer for review and advice.
2015-09-07 14:36:39 -04:00
Tim Graham 97ac77e544 Removed BaseForm._raw_value().
Unused since efb0100ee6.
2015-08-21 12:14:54 -04:00
Tim Graham 8656cfc4e0 Removed forms.models.save_instance() function.
As of b11564fd36 it's no longer
used elsewhere in Django and it isn't a documented public API.

Thanks Simon Charette for review.
2015-08-07 08:18:09 -04:00
Tim Graham f2b665f886 Fixed #25241 -- Corrected ModelForm.save() error message when saving invalid form with UUIDField pk. 2015-08-07 07:44:59 -04:00
Curtis Maloney c6c00fbfbb Used @cached_property for BaseForm.changed_data. 2015-08-04 07:12:28 -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
George Brocklehurst 48af591b2d Fixed #25124 -- Eased customization of SelectDateWidget subwidget. 2015-07-15 10:21:39 -04:00
Eric Carrillo 8ee6a3f1a8 Fixed #25085 -- Overrode Select widget's __deepcopy__() 2015-07-14 11:56:08 -04:00
Simon Litchfield 0ffa3943fb Fixed #25097 -- Added BaseModelFormSet.delete_existing() hook. 2015-07-14 09:05:44 -04:00
Curtis 11cac1bd8e Fixed #4960 -- Added "strip" option to CharField 2015-07-01 17:47:05 -04:00
Jason Hoos a50b66da30 Fixed #24958 -- Fixed inline forms using UUID-PK parents with auto-PK children. 2015-06-26 09:09:09 -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
TMFGravyHands 339c01fb75 Allowed easier extendability of ChoiceFieldRenderer. 2015-06-11 10:15:52 -04:00
Matthew Schinckel bbff3147f2 Made flatatt docstring match reality
The spirit of the docstring was correct, but referred to an outdated version of the function.
2015-06-08 13:57:25 +02:00
Markus Amalthea Magnuson 1884bf8e8e Fixed #12437 -- Added css_classes to Form._html_output() 2015-06-06 19:23:06 -04:00
Russell Keith-Magee 5c35b4a8c9 Added release notes for feature added in fe21fb81 2015-06-05 11:42:58 +01:00
Russell Keith-Magee fe21fb810a Merge pull request #4757 from sergei-maertens/ticket_18166
Fixed #18166 -- Added ability to pass kwargs to the form constructor in a formset.
2015-06-05 11:10:28 +01:00
Alasdair Nicol 5987b3c46d Removed comment from Form.changed_data; refs #24191 2015-06-04 13:51:26 -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
Piotr Jakimiak 4157c502a5 Removed unnecessary arguments in .get method calls 2015-05-13 20:51:18 +02:00
Peter Schmidt 681df1aeaf Fixed #24771 -- Simplified ModelForm._post_clean()
This code added in 45e049937d
is no longer necessary to pass the model_formsets_regress tests
as of 5e2c4a4bd1.
2015-05-08 12:11:10 -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
Luis Del Giudice 69ddc1b3da Fixed #24693 -- Added label and label_lower property to Model._meta 2015-05-02 16:58:18 +02:00
Curtis Maloney 14ecbd02a3 Removed cases of six.iter* wrapped in a list()
There's absolutely no advantage [and a mild performance hit] to using six.iter*
in these cases.
2015-04-18 23:29:29 +10: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
Anssi Kääriäinen 8f30556329 Renamed Field.rel attribute to remote_field
Field.rel is now deprecated. Rel objects have now also remote_field
attribute. This means that self == self.remote_field.remote_field.

In addition, made the Rel objects a bit more like Field objects. Still,
marked ManyToManyFields as null=True.
2015-03-25 08:16:12 -04:00
Moritz Sichert 6bff343989 Refs #24469 -- Fixed escaping of forms, fields, and media in non-Django templates. 2015-03-18 09:11:01 -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
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
Stanislas Guerra 4c2f546b55 Fixed #24395 -- Ensured inline ModelsForms have an updated related instance. 2015-02-24 11:49:00 -05:00
Tim Graham 1306cd1e8a Fixed #24377 -- Fixed model inline formsets with primary key's that have defaults. 2015-02-23 08:44:27 -05: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
Loic Bistuer 00a889167f Fixed #24295 -- Allowed ModelForm meta to specify form field classes.
Thanks Carl Meyer and Markus Holtermann for the reviews.
2015-02-13 19:13:05 +07:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Tim Graham bbe28496d3 Removed old import aliases. 2015-02-05 19:37:01 -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
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 9704b0a82e Removed forms.forms.get_declared_fields() per deprecation timeline; refs #19617. 2015-01-18 15:55:01 -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 2b4ca2ec29 Removed unused imports. 2015-01-17 14:42:51 -05:00
Tim Graham 2788c46d46 Removed Multiple/ModelChoiceField cache_choices option; refs #22838. 2015-01-17 13:48:46 -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
Tim Graham baf2542c4f Fixed DoS possibility in ModelMultipleChoiceField.
This is a security fix. Disclosure following shortly.

Thanks Keryn Knight for the report and initial patch.
2015-01-13 13:03:06 -05:00
Josh Schneier 3844ccc958 Fixed #24138 -- Added modelform_factory to __all__. 2015-01-12 17:44:06 -05:00
Daniel Pyrathon fb48eb0581 Fixed #12663 -- Formalized the Model._meta API for retrieving fields.
Thanks to Russell Keith-Magee for mentoring this Google Summer of
Code 2014 project and everyone else who helped with the patch!
2015-01-06 19:25:12 -05:00
Anssi Kääriäinen f233bf47dd Fixed #21414 -- Removed RelatedObject and deprecated Field.related. 2014-12-23 10:54:25 -05: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
Michael Hall 895dc880eb Fixed #23812 -- Changed django.utils.six.moves.xrange imports to range 2014-12-13 12:45:58 -05:00
Grzegorz Slusarek 0dea81cd6d Fixed #23674 -- Fixed a crash when a MultiValueField has invalid data. 2014-12-12 08:47:21 -05:00
Jon Dufresne 4468c08d70 Fixed #23968 -- Replaced list comprehension with generators and dict comprehension 2014-12-08 07:58:23 -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
Simon Charette a7c3d0f288 Fixed typo in forms/models.py comment. 2014-11-21 15:59:09 -05:00
Tim Heap 5b17dcd8ef Fixed #23883 -- Stopped flatatt modifying its argument 2014-11-21 09:45:08 +01:00
Baptiste Mispelon bfb11b9562 Fixed #23795 -- Fixed a regression in custom form fields
Custom form fields having a `queryset` attribute but no
`limit_choices_to` could no longer be used in ModelForms.

Refs #2445.

Thanks to artscoop for the report.
2014-11-12 22:38:18 +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
Tim Graham 984a57a9c9 Removed some commented code in the forms Media class. 2014-10-27 08:21:37 -04:00
Thomas Chaumeny fa534b92dd Fixed #23623 -- Reduced memory consumption when generating ModelChoiceField choices 2014-10-10 09:50:02 -04: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
Petras Zdanavičius f7eee04ebe Fixed #23451 -- Fixed typo in inlineformset_factory() error message. 2014-09-08 17:22:23 -04:00
Tim Graham 1101467ce0 Limited lines to 119 characters in django/
refs #23395.
2014-09-05 09:22:16 -04:00
Vlastimil Zíma e622caaa85 Fixed #21201 -- Improved customization of ClearableFileInput. 2014-08-29 09:40:08 -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
Vincent-Vega 5e06fa1469 Fixed #22745 -- Prevented reevaluation of ModelChoiceField's queryset when accesssing BoundField's attrs.
Thanks Christian Schmitt for review.
2014-08-04 07:47:37 -04:00
Tim Graham 399cf303cb Corrected a comment in forms/forms.py; refs #16612. 2014-08-04 06:57:09 -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