Commit Graph

391 Commits

Author SHA1 Message Date
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
Ramiro Morales 8c2fd050f8 Made fix for #9321 less buggy and more effective.
Don't try to be smart about building a good-looking help string
because it evaluates translations too early, simply use the same old
strategy as before. Thanks Donald Stufft for the report.

Also, actually fix the case reported by the OP by special-casing
CheckboxSelectMultiple.

Added tests.

Refs #9321.
2013-05-23 07:49:29 -03:00
Jeroen Dekkers d0788c2770 Fixed #18709 -- Check if initial_value is a callable
In _get_changed_data, check if initial_value is a callable and call it
if it is.
2013-05-22 01:05:22 +02:00
Ramiro Morales 4ba1c2e785 Fixed #9321 -- Deprecated hard-coding of help text in model ManyToManyField fields.
This is backward incompatible for custom form field/widgets that rely
on the hard-coded 'Hold down "Control", or "Command" on a Mac, to select
more than one.' sentence.

Application that use standard model form fields and widgets aren't
affected but need to start handling these help texts by themselves
before Django 1.8.

For more details, see the related release notes and deprecation timeline
sections added with this commit.
2013-05-20 16:29:51 -03:00
Ryan Kaskel 4280217f31 Fixed #20403 -- Ignore forms marked for deletion when validating max_num. 2013-05-20 12:13:21 -04:00
Andrew Godwin 04e0fc029f Merge pull request #1094 from senko/ticket_11160
Fixed #11160: Formset non_form_errors returns ErrorList() if is_valid is not called
2013-05-19 03:56:14 -07:00
Tome Cvitan caf56ad174 Fixed #20440 -- Ensured CharField's max_length/min_length are integers 2013-05-18 22:30:24 +02:00
Aymeric Augustin 7d050e8e9c Merge pull request #1113 from denibertovic/master
Fixed #18761 -- Added whitespace stripping to URLField and SlugField.
2013-05-18 07:11:11 -07:00
Deni Bertovic 186ec21a3d Added stripping of whitespace for SlugField and URLField 2013-05-18 16:06:08 +02:00
Erik Romijn 1c1695668f Fixed argument order for localized_fields to ensure backwards compatibility 2013-05-18 14:38:45 +02:00
Erik Romijn 756b81dbd1 Fixed #13546 -- Easier handling of localize field options in ModelForm 2013-05-18 14:13:00 +02:00
Senko Rasic 493aca453a Fixed #11160 - Ensure full_clean is called from non_form_errors
Updated FormSet.non_form_errors() to ensure full_clean() has
been called before returning the errors.
2013-05-18 13:44:27 +02:00
Aymeric Augustin 9c487b5974 Replaced an antiquated pattern.
Thanks Lennart Regebro for pointing it out.
2013-05-17 18:08:58 +02:00
Daniel Lindsley 33793f7c3e Fixed #19934 - Use of Pillow is now preferred over PIL.
This starts the deprecation period for PIL (support to end in 1.8).
2013-05-14 19:32:04 -07:00
Luke Plant f026a519ae Fixed #19733 - deprecated ModelForms without 'fields' or 'exclude', and added '__all__' shortcut
This also updates all dependent functionality, including modelform_factory
 and modelformset_factory, and the generic views `ModelFormMixin`,
 `CreateView` and `UpdateView` which gain a new `fields` attribute.
2013-05-09 16:44:36 +01:00
Claude Paroz f9f0e8da4d Used ngettext in a formsets error message
Several languages will distinctly translate '%d or fewer forms'
depending on the variable.
2013-05-04 10:18:04 +02:00
Claude Paroz be9ae693c4 Fixed #17840 -- Generalized named placeholders in form error messages
Also fixed plural messages for DecimalField.
2013-04-13 18:55:50 +02:00
Baptiste Mispelon 9ac4dbd7b5 Fixed #4592: Made CheckboxSelectMultiple more like RadioSelect
I refactored RadioSelect and CheckboxSelectMultiple to
make them inherit from a base class, allowing them to share
the behavior of being able to iterate over their subwidgets.

Thanks to Matt McClanahan for the initial patch and to
Claude Paroz for the review.
2013-04-13 16:37:27 +02:00
Baptiste Mispelon c4186c2fec Fixed #4117: Apply id attribute to the outer <ul> of RadioSelect 2013-04-13 12:23:25 +02:00
Baptiste Mispelon 844fbc85c1 Fixed #19874: Apply id attribute to the outer <ul> of CheckboxSelectMultiple 2013-04-13 11:09:47 +02:00
Baptiste Mispelon ab686022f8 Fixed #20211: Document backwards-incompatible change in BoundField.label_tag
Also cleaned up label escaping and consolidated the test suite regarding
label_tag.
2013-04-12 10:17:17 +02:00
Baptiste Mispelon f9dc1379b8 Fix #15126: Better error message when passing invalid options to ModelForm.Meta. 2013-04-07 19:08:53 +02:00
Gavin Wahl ec04fd1344 Fixed spelling errors 2013-03-28 11:16:53 -06:00
Claude Paroz 066bf42675 Removed forced typecasting of help_text/label Field arguments
In any case, setting those variables to non-ascii utf-8 bytestrings
is now considered a programming error.
2013-03-25 21:38:21 +01:00
Anssi Kääriäinen 97774429ae Fixed #19385 again, now with real code changes
The commit of 266de5f9ae included only
tests, this time also code changes included...
2013-03-24 18:40:40 +02:00
Andrew Gorcester f9ab543720 Fixed #20084 -- Provided option to validate formset max_num on server.
This is provided as a new "validate_max" formset_factory option defaulting to
False, since the non-validating behavior of max_num is longstanding, and there
is certainly code relying on it. (In fact, even the Django admin relies on it
for the case where there are more existing inlines than the given max_num). It
may be that at some point we want to deprecate validate_max=False and
eventually remove the option, but this commit takes no steps in that direction.

This also fixes the DoS-prevention absolute_max enforcement so that it causes a
form validation error rather than an IndexError, and ensures that absolute_max
is always 1000 more than max_num, to prevent surprising changes in behavior
with max_num close to absolute_max.

Lastly, this commit fixes the previous inconsistency between a regular formset
and a model formset in the precedence of max_num and initial data. Previously
in a regular formset, if the provided initial data was longer than max_num, it
was truncated; in a model formset, all initial forms would be displayed
regardless of max_num. Now regular formsets are the same as model formsets; all
initial forms are displayed, even if more than max_num. (But if validate_max is
True, submitting these forms will result in a "too many forms" validation
error!) This combination of behaviors was chosen to keep the max_num validation
simple and consistent, and avoid silent data loss due to truncation of initial
data.

Thanks to Preston for discussion of the design choices.
2013-03-21 01:27:24 -07:00
Carny Cheng aaec4f2bd8 Fixed #18839 - Field.__init__() now calls super(). 2013-03-20 16:20:57 -07:00
konarkmodi bc4111ba68 Fixed #18003 -- Preserved tracebacks when re-raising errors.
Thanks jrothenbuhler for draft patch, Konark Modi for updates.
2013-03-19 15:42:39 -07:00
Claude Paroz 2f121dfe63 Fixed #17051 -- Removed some 'invalid' field error messages
When the 'invalid' error message is set at field level, it masks
the error message raised by the validator, if any.
2013-03-14 17:03:43 +01:00
Claude Paroz 9883551d50 Fixed #20039 -- Fixed has_changed form detection for required TypedChoiceFields
Thanks Florian Apolloner for the report and the review.
Also fixes #19643.
2013-03-14 14:49:07 +01:00
Claude Paroz cbfb8ed53b Fixed a regression in forms changed_data
Thanks Loic Bistuer for spotting the regression and the initial
patch. Refs #16612.
2013-03-08 18:19:24 +01:00
Loic Bistuer 6983a1a540 Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
Claude Paroz 4cccb85e29 Fixed #19997 -- Added custom EMPTY_VALUES to form fields
Thanks Loic Bistuer for the report and the patch.
2013-03-07 15:22:03 +01:00
Claude Paroz 51cc7029b9 Fixed #19464 -- Eased customization of ClearableFileInput's link markup
Thanks rubyruy for the report and the patch.
2013-03-04 17:03:48 +01:00
Claude Paroz 3318595c0b Fixed #18898 -- Added tests with a fix for ModelMultipleChoiceField 2013-03-01 09:35:18 +01:00
Claude Paroz 892bc91cb0 Fixed #16612 -- Improved has_changed detection for localized field values
Thanks Simon Charette for the review.
2013-03-01 09:35:04 +01:00
Claude Paroz 5eebb49c69 Fixed #19908 -- Added missing import in forms.py
Thanks loic84 for the report.
2013-02-24 22:59:15 +01:00
Klaas van Schelven 1c11ee6345 Fixed #18829 -- Fixed ModelChoiceIterator length
Thanks facundo.olano at gmail.com for the report and thikonom for
the initial patch.
2013-02-23 22:27:07 +01:00
Florian Apolloner 5ae0c933a8 Fixed errors introduced in 21f333bcef. Refs #17751 2013-02-23 18:43:34 +01:00
Claude Paroz cc53d9b30b Fixed #15877 -- Improved exception when ModelForm has no model class
Thanks theaspect at gmail.com for the report and volrath for the
patch.
2013-02-23 18:32:29 +01:00
Erik Romijn 21f333bcef Fix #17751: Added stripping of whitespace for IPAddressField/GenericIPAddressField 2013-02-23 14:44:57 +01:00
Klaas van Schelven 91c9470664 Method "save" in BaseModelFormSet is marked as alters_data
Fixes #17663
2013-02-23 13:01:28 +01:00
Claude Paroz 7ec2a21be1 Fixed #19686 -- Added HTML5 number input type
Thanks Simon Charette for his help on the patch. Refs #16630.
2013-02-23 10:18:08 +01:00
Aymeric Augustin 35c991aa06 Added a default limit to the maximum number of forms in a formset.
This is a security fix. Disclosure and advisory coming shortly.
2013-02-19 11:23:30 -07:00
Claude Paroz f44922c795 Fixed #18906 -- Ignored to-be-deleted forms in formset validate_unique
Thanks c.pollock at bangor.ac.uk for the report.
2013-02-08 21:35:19 +01:00
Simon Charette a097ee32d8 Fixed #17683 -- Make sure `BaseModelFormSet` respects defined widgets. 2013-02-05 05:39:35 -05:00
Claude Paroz 5b4805ae2b Merge pull request #686 from skrr/ticket_19703
Fixed #19703 -- Typo in get_declared_fields docstring
2013-01-30 13:29:56 -08:00
Claude Paroz fc8efc2d9e Fixed #19034 -- Added proper i18n pluralization for max/min length validation messages
This was made possible by commit 3f1a0c0040. Thanks Evil Clay
for the report and Alexey Boriskin his work on the ticket.
2013-01-30 21:44:14 +01:00
Simon Kerr 52533a64d5 fixed minor typo #19703 2013-01-30 19:48:05 +01:00
Claude Paroz f7394d2c32 Added HTML5 url input type
Refs #16630.
2013-01-28 22:11:00 +01:00