Commit Graph

199 Commits

Author SHA1 Message Date
Tim Graham 8442268869 Added an anchor for django.forms.Form.clean in docs 2013-08-08 14:13:52 -04: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 Graham 05ea5a2139 Fixed #20823 -- Typo in docs/ref/forms/validation.txt 2013-07-29 18:41:08 -04:00
minusf 70c080fcdb Misc doc cleanups. 2013-07-29 06:57:33 -04: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 7557207983 Fixed #20582 -- Allowed default Form.label_suffix to be translated
Thanks Tim Graham for the review.
2013-07-13 16:19:16 +02:00
James Bennett c0f03175ce Fixed #19695 -- Retitle "Form Media" to "Form Assets". 2013-07-08 13:59:54 -04:00
Tim Graham 181f63c22d Fixed #12346 -- Added a note on how to validate InlineFormSets.
Thanks johnsmith for the suggestion.
2013-07-08 08:29:28 -04:00
Claude Paroz 7442eb1a24 Fixed #20224 -- Update docs examples which mention __unicode__
Thanks Marc Tamlyn and Tim Graham for the review.
2013-07-05 19:27:07 +02:00
Tim Graham 3632d289de A couple more semicolon -> colon fixes; refs #18134. 2013-07-02 14:14:56 -04:00
Loic Bistuer ee77d4b253 Fixed #20199 -- Allow ModelForm fields to override error_messages from model fields 2013-06-18 08:01:17 -04:00
Loic Bistuer 9e50833e22 Fixed #20000 -- Allowed ModelForm meta overrides for label, help_text and error_messages 2013-06-13 15:06:25 -04: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
Tim Graham 175a102ddc Fixed #20567 - Documented BoundField.id_for_label.
Thanks littlepig for the suggestion.
2013-06-09 12:13:43 -04:00
Tim Graham bb863faecd Proofed the 1.6 release notes 2013-06-05 12:55:58 -04:00
leandrafinger 08b501e7d3 add missing imports to the examples in the 'Forms' 2013-05-19 13:31:45 +02:00
Erik Romijn 756b81dbd1 Fixed #13546 -- Easier handling of localize field options in ModelForm 2013-05-18 14:13:00 +02:00
Claude Paroz b16b72d415 Fixed #5472 --Added OpenLayers-based widgets in contrib.gis
Largely inspired from django-floppyforms. Designed to not depend
on OpenLayers at code level.
2013-05-17 13:33:40 +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
Juan Catalano 78c842a323 Adapted uses of versionchanged/versionadded to the new form.
Refs #20104.
2013-04-20 17:18:35 +02:00
Claude Paroz 5306285ce2 Complemented documentation following commit be9ae693c
Refs #17840. Thanks Carl Meyer for noticing the omission.
2013-04-18 20:38:07 +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
Claude Paroz 0f99246b6f Documented BoundField.label_tag 2013-04-12 10:17:17 +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
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
Tim Graham 8e5fbebe02 Fixed #19801 - Added brackets to input_formats.
Thanks leandron85@ for the suggestion.
2013-02-25 12:22:02 -05: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
Tim Graham 7a80904b00 Fixed #19812 - Removed a duplicate phrase in the widget docs.
Thanks diegueus9 for the report and itsallvoodoo for the draft patch.
2013-02-16 18:23:39 -05:00
Claude Paroz f7394d2c32 Added HTML5 url input type
Refs #16630.
2013-01-28 22:11:00 +01:00
Claude Paroz 4f16376274 Added HTML5 email input type
Refs #16630.
2013-01-28 22:10:50 +01:00
Nick Sandford 93e79b45bc Fixed #17416 -- Added widgets argument to inlineformset_factory and modelformset_factory 2013-01-24 08:58:17 +01:00
Tim Graham 0de2645c00 Fixed #19610 - Added enctype note to forms topics doc.
Thanks will@ for the suggestion.
2013-01-23 04:49:48 -05:00
Tim Graham 5b2d9bacd2 Fixed #19640 - Added inlineformset_factory to reference docs.
Thanks wim@ for the suggestion.
2013-01-22 07:55:34 -05:00
Tim Graham 71d76ec011 Fixed #10239 - Added docs for modelform_factory
Thanks ingenieroariel for the suggestion and slurms for the review.
2013-01-11 06:00:19 -05:00
Tim Graham 9b5f64cc6e Fixed #19516 - Fixed remaining broken links.
Added -n to sphinx builds to catch issues going forward.
2013-01-02 18:32:57 -05:00
Aymeric Augustin 7ee7599ab3 Removed versionadded/changed annotations dating back to 1.4. 2012-12-29 21:59:08 +01:00
Claude Paroz 2d0b35d2bb Added links to default widget in forms.fields documentation 2012-12-29 11:30:12 +01:00
Tim Graham b3a8c9dab8 Fixed broken links, round 3. refs #19516 2012-12-26 19:07:22 -05:00
Tim Graham 04775b4598 Fixed #13997 - Added an example of constructing a MultiWidget and documented the value_from_datadict method. 2012-11-17 17:54:09 -05:00
Danilo Bargen b0c72d0a30 Fixed invalid ipv4 mapped ipv6 addresses in docs 2012-11-07 17:13:06 +01:00
Claude Paroz 22742e4ac4 Added ref to format localization in Date[Time]Field docs
Thanks henrik@aisti.fi for the suggestion in #19119.
2012-10-13 11:17:25 +02:00
Claude Paroz 10dc4797ea Fixed #19119 -- Corrected default date input formats in docs
Thanks henrik@aisti.fi for the report.
2012-10-13 11:02:18 +02:00
Stephen Burrows 218abcc9e5 Fixed #14567 -- Made ModelMultipleChoiceField return EmptyQuerySet as empty value 2012-10-03 20:47:35 +03:00
Adrien Lemaire 2c8267bf3d Fixed #17899 -- Rewrote [Ee]-mail to [Ee]mail 2012-09-26 14:14:51 +02:00
Tim Graham 837425b425 Fixed #18934 - Removed versionadded/changed annotations for Django 1.3 2012-09-20 19:06:55 -04:00
Tim Graham a73838fde3 Fixed #11185 - Expanded docs on customizing widgets; thanks fadeev for the draft patch. 2012-09-15 06:22:00 -04:00
Claude Paroz f1bdfbd24b Document and test 'type' usage in Widget attrs
Refs #16630.
2012-09-10 19:31:11 +02:00
Tim Graham fa8fb2b383 Fixed #18490 - Updated DateField input formats; thanks dloewenherz for the draft patch. 2012-09-07 19:49:38 -04:00
James Bennett 46249061d6 Merge pull request #333 from brad/ticket_18917
clarify clean_<field> docs, ticket #18917
2012-09-07 12:00:01 -07:00
Alex Gaynor 6a5a12ea3e Fixed #17888 -- no longer silence exceptions inside of check_test. Thanks to brutasse for the patch. 2012-09-07 14:37:21 -04:00
Brad Pitcher c634375e9c clarify clean_<field> docs, ticket #18917 2012-09-07 10:43:55 -04:00
Claude Paroz 121fd109de Fixed #5524 -- Do not remove cleaned_data when a form fails validation
cleaned_data is no longer deleted when form validation fails but only
contains the data that did validate.
Thanks to the various contributors to this patch (see ticket).
2012-08-04 14:22:23 +02:00
Aymeric Augustin 5e94ef293c Fixed #18374 -- Explained "corrupt image" error
Thanks fabian and charettes.
2012-07-08 11:53:45 +02:00
Tim Saylor f8ef93a657 Fixed a documentation typo on the widget page. 2012-06-19 10:37:53 +02:00
Aymeric Augustin 33999d9871 Fixed #18445 -- Added a links in the docs.
Thanks Audrey Roy for the patch.
2012-06-07 22:11:24 +02:00
Claude Paroz 4a103086d5 Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.
Thanks Vinay Sajip for the support of his django3 branch and
Jannis Leidel for the review.
2012-06-07 18:08:47 +02:00
Aymeric Augustin c28e700c7e Removed references to changes made in 1.2.
Thanks Florian Apolloner for the patch.
2012-06-07 15:02:35 +02:00
Jacob Kaplan-Moss 7edf231d46 Replaced documentation snippets using "gender" with less sensitive examples. 2012-06-06 13:52:53 +02:00
Aymeric Augustin 73f7d34699 Fixed #17950 -- Warned about usability limits of ModelChoiceField.
Thanks poirier for the report.
2012-05-10 22:01:11 +02:00
Claude Paroz 596cb9c7e2 Replaced print statement by print function (forward compatibility syntax). 2012-04-30 20:45:03 +02:00
Alex Gaynor 3c5ff9d703 Fixed #5893 -- Added a flag to FilePathField to allow listing folders, in addition to regular files. Thank you to Brian Rosner, for encouraging me to first contribute to Django 4 years ago.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17925 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-04-22 14:44:08 +00:00
Aymeric Augustin 9ed6e08ff9 Removed deprecated URLField.verify_exists.
The deprecation schedule was slightly accelerated because of possible security ramifications.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@17847 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-03-31 13:55:03 +00:00
Jannis Leidel 52d72a5a3e Fixed #17182 -- Changed best practice documentation for Form.clean to use super() instead of relying on self.cleaned_data. Thanks, DrMeers.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17433 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-04 16:05:30 +00:00
Adrian Holovaty 08bec4fbc1 Changed BoundField.subwidgets() to return SubWidget objects instead of rendered strings. This means we can access individual radio buttons' properties in the template (see new docs)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17175 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-07 23:08:27 +00:00
Adrian Holovaty fc90c09efd Made BoundFields iterable, so that you can iterate over individual radio buttons of a RadioSelect in a template
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17173 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-07 22:31:39 +00:00
Luke Plant d1e5c55258 Fixed many more ReST indentation errors, somehow accidentally missed from [16955]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16983 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-14 00:12:01 +00:00
Julien Phalip ca1e670499 Fixed some improper quotes in the form fields reference doc.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16821 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-12 07:15:47 +00:00
Julien Phalip 4e47df9de2 Fixed #16291 -- Documented that TypedChoiceField does not coerce empty_value. Thanks to vanschelven and taavi223.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16820 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-12 07:12:28 +00:00
Carl Meyer 84e0055e8d Corrected documentation inconsistencies regarding deprecation of URLField.verify_exists.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16776 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-10 03:26:13 +00:00
Russell Keith-Magee 5f287f75f2 Altered the behavior of URLField to avoid a potential DOS vector, and to avoid potential leakage of local filesystem data. A security announcement will be made shortly.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16760 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-10 00:47:00 +00:00
Ramiro Morales 932b1b8d6d Converted links to external topics so they use intersphinx extension markup.
This allows to make these links more resilent to changes in the target URLs.
Thanks Jannis for the report and Aymeric Augustin for the patch.

Fixes #16586.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16720 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-04 21:17:30 +00:00
Timo Graham 24a45a5fda Fixed #16602 - Added forms.widgets TOC links to docs; thanks kencochrane.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16633 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-21 11:51:48 +00:00
Gabriel Hurley 40c8a603c3 Fixed #16591 -- Fixed some mismatched variable names in a widgets reference example. Thanks to santi.romero, el barto, and julien.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16626 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-18 22:39:20 +00:00
Jannis Leidel 566b3295fa Fixed #16621 -- Fixed lots of typos in the docs. Thanks, Bernhard Essl.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16615 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-13 11:58:19 +00:00
Timo Graham ee7cac0806 Fixed #16434 - corrected "django.forms.widgets.extras" to "django.forms.extras.widgets"; thanks rfk.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16528 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-07-09 12:19:29 +00:00
Jannis Leidel 662b372d02 Fixed #16264 -- Improved form widget documentation. Many thanks to Bas Peschier.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16408 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-16 15:27:19 +00:00
Jannis Leidel ce3c281090 Fixed #811 -- Added support for IPv6 to forms and model fields. Many thanks to Erik Romijn.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16366 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-11 13:48:24 +00:00
Jannis Leidel 49f57a5d28 Fixed #15992 -- Added more references to settings. Thanks, aaugustin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16290 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-05-29 17:41:04 +00:00
Simon Meers 5ecb88c146 Fixed #16014 -- numerous documentation typos -- thanks psmith.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16220 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-05-13 04:33:42 +00:00
Chris Beaven 534c427b20 Fixed #13584 -- Optionally allow empty files with django.forms.FileField. Thanks for the patch erickr and closedbracket.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16090 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-22 21:18:27 +00:00
Adrian Holovaty 9a279edc1c Fixed some ReST errors from e-mail -> email change in docs, and changed some docs that shouldn't have been changed (because translation strings haven't been converted yet)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15968 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-01 16:18:23 +00:00
Adrian Holovaty 94af19c43f Changed e-mail to email throughout documentation and codebase. The one exception is translation strings, which I didn't want to disrupt
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15967 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-01 16:10:22 +00:00
Simon Meers 8e7030d263 Fixed typo in forms API documentation.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15896 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-22 23:16:22 +00:00
Chris Beaven 32adde7fc9 Fix the documentation of BoundField.value() to reference the correct method name
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15772 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-07 22:55:16 +00:00
Gabriel Hurley 28123d7153 Fixed #15492 -- Documented the `invalid_date` and `invalid_time` error keys for !SplitDateTimeField. Thanks to lode for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15663 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-27 21:16:58 +00:00
Gabriel Hurley 319de16ff0 Fixed #15233 -- reST/Sphinx markup corrections in numerous areas, mostly centering around bad crossref targets. Thanks to Aryeh Leib Taurog for the draft patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15549 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-16 01:56:53 +00:00
Timo Graham 3cdd6d898e Fixed #15204 - Update form examples for rendering of the help_text; thanks prestontimmons.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15396 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-02 20:23:13 +00:00
Timo Graham 456534dda9 Fixed #15191 - typo in form validation docs; thanks berto for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15372 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-30 19:09:44 +00:00
Timo Graham 40d1a478fd Fixed #11496 - note that DecimalField max/min_value should be type(decimal.Decimal); thanks adamv.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15084 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-28 21:54:47 +00:00
Timo Graham 5c6a9f35a9 Refs #12398 - TypedMultipleChoiceField is new in Django 1.3
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15082 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-28 21:29:34 +00:00
Timo Graham b0ecab516f Fixed #14708 - Document available keys for form field error messages; thanks adamv.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15080 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-28 21:10:19 +00:00
Timo Graham 2ea93f9327 Fixed #14000 - remove versionadded/changed tags for Django 1.0 and 1.1
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15055 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-26 00:37:14 +00:00
Russell Keith-Magee 4a1f2129d0 Fixed #12398 -- Added a TypedMultipleChoiceField. Thanks to Tai Lee.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14829 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-05 04:47:19 +00:00
Chris Beaven d3f5f219f5 Fixes #10427 -- Abstract the value generation of a BoundField
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14734 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-28 02:50:31 +00:00
Chris Beaven 4c5bf6c76c Fixes #14759 -- document the 'years' argument for SelectDateWidget. Thanks Bartolomé Sánchez
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14685 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-23 02:46:55 +00:00
Alex Gaynor 60ad315bc9 Fixed #14650 -- noted that underscores are also valid in slug fields. Thanks to stringify for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14503 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-09 05:18:47 +00:00