Commit Graph

250 Commits

Author SHA1 Message Date
Niclas Åhdén 64ee097b3b Fixed #22639 -- Added missing imports in docs
Added ModelForm and NON_FIELD_ERRORS imports.
2014-05-21 17:11:01 +02:00
Niclas Åhdén 7271f5db78 Fixed #22622 -- Added ugettext_lazy import in docs 2014-05-16 11:20:31 -04:00
Marti Raudsepp 11d453bcad Various documentation typo/spelling fixes
Errors detected by Topy (https://github.com/intgr/topy), all changes
verified by hand.
2014-04-23 02:31:49 +03:00
Ramiro Morales cb5dd99bb4 Corrected an import in a model form docs example. 2014-03-30 20:31:07 -03:00
Tim Graham 51c8045145 Removed versionadded/changed annotations for 1.6. 2014-03-24 11:42:56 -04:00
Claude Paroz 3a97f992fb Fixed #22313 -- Removed 'u' prefixes from documentation 2014-03-22 21:32:20 +01:00
Tim Graham ee4edb1eda Made ModelForms raise ImproperlyConfigured if the list of fields is not specified.
Also applies to modelform(set)_factory and generic model views.

refs #19733.
2014-03-22 07:56:48 -04:00
Tim Graham 1f5f015c32 Fixed spelling mistakes in docs. 2014-02-28 21:03:46 -05:00
Tim Graham 7f2505ad9e Fixed doc typos. 2014-02-28 11:44:03 -05:00
Szczepan Cieślik e816198034 Fixed docs typos. 2014-02-25 10:28:32 -05:00
Alasdair Nicol 8aa1efff6d Fixed #21951 -- Updated docs to use __str__ for Python 3
Thanks Tim Graham for the report and recommendations
2014-02-13 07:12:40 -05:00
Loic Bistuer 8847a0c601 Fixed #16192 -- Made unique error messages in ModelForm customizable.
Overriding the error messages now works for both unique fields, unique_together
and unique_for_date.

This patch changed the overriding logic to allow customizing NON_FIELD_ERRORS
since previously only fields' errors were customizable.

Refs #20199.

Thanks leahculver for the suggestion.
2014-02-08 04:59:09 -05:00
Tom Atkins 3b869b09d0 Fixed #21847 -- Clarified where ContactForm was defined 2014-01-23 13:48:09 -05:00
Baptiste Mispelon 79e1d6ebd7 Don't show `self` in the list of arguments of a method.
This is consistent with Python's official documentation
and it's a sphinx recommendation too[1].

[1] http://sphinx-doc.org/markup/desc.html#dir-method

Refs #21855.
2014-01-22 22:17:32 +01:00
Alasdair Nicol 1fa681ee11 Fixed #21539 -- Added example of modelformset_factory's form argument 2013-12-14 16:35:14 -05:00
Christian Schmitt 744aac6dac Fixed #21560 -- missing 'slug' field in example code
I updated the documentation, that the modelform now includes the 'slug' field.
2013-12-09 22:54:11 +01:00
Loic Bistuer 033b26173b Improved docs for ModelFormSet.clean(). 2013-11-22 19:48:54 -05:00
Tianyi Wang 944a2bb7c1 Improvement on InlineFormSet doc, refs #21006 2013-10-15 14:51:45 +01:00
Tianyi Wang 9bfe66164e Fixed #21006 -- Added example code for overriding methods on an InlineFormSet.
Thanks treysta at gmail.com for the suggestion.
2013-10-15 07:34:29 -04: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
Sorcha Bowler 018e2c055a Fixed #21223 -- Added form.id_for_label to topic guide.
Thanks ebertti at yahoo.com.br for the suggestion.
2013-10-14 18:41:22 -04:00
Loic Bistuer b16dd1fe01 Fixed #8620 -- Updated the Form metaclass to support excluding fields by shadowing them. 2013-10-14 22:42:33 +07: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
Loic Bistuer 54cd930baf Clarfied the ModelForm docs with respect to generated vs. declared fields.
The ModelForm docs suggested that fields defined declaratively override
default fields generated from the form Meta.

This is conceptually wrong, especially with inheritance in mind. Meta is
usually defined on the topmost ModelForm subclass, while fields can come
from anywhere in the MRO, especially base classes; therefore we suggested
that something defined in a base class override something from a subclass.

This patch rephrases the docs around the idea that Meta is used to generate
*missing* fields.

Refs #8620, #19617.

Thanks @mjtamlyn and @timgraham for the review.
2013-10-14 10:54:22 -04: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 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
Phaneendra Chiruvella 2fbf949760 Minor spelling correction in ModelForms docs 2013-08-28 16:05:46 +05:30
Dominic Rodger c33d1ca1d9 Fixed #20852 - Fixed incorrectly generated left quotes in docs.
Sphinx generates left single quotes for apostrophes after
code markup, when right single quotes are required. The
easiest way to fix this is just by inserting the unicode
character for a right single quote.

Instances of the problem were found by looking for
">‘" in the generated HTML.
2013-08-06 07:13:17 -04:00
Tim Graham 65e03a424e Fixed #10284 -- ModelFormSet.save(commit=False) no longer deletes objects
Thanks laureline.guerin@ and Wedg.
2013-07-23 16:21:23 -04:00
Loic Bistuer aa41eb9b8b Fixed #20772 -- Fixed minor typo in form media docs. 2013-07-19 15:48:38 +07:00
Loic Bistuer fba6c2ede7 Reworked docs for ModelForm validation. 2013-07-16 19:20:53 -04:00
James Bennett c0f03175ce Fixed #19695 -- Retitle "Form Media" to "Form Assets". 2013-07-08 13:59:54 -04:00
Tim Graham 660c30ed95 Fixed #16965 -- Clarified Formset can_delete docs.
Thanks gregcorey@ for the suggestion.
2013-07-08 12:08:30 -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
Ben Firshman 8160e6341d Fix "semicolon" in docs 2013-07-02 17:52:54 +01: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
Loic Bistuer 9e50833e22 Fixed #20000 -- Allowed ModelForm meta overrides for label, help_text and error_messages 2013-06-13 15:06:25 -04:00
Wilfred Hughes b79aa796d8 FormSet.forms is an iterable, so just iterate over it 2013-06-11 16:05:19 +01:00
Tim Graham 9ff5f100dd Fixed #20578 - Typo in BaseFormSet module name 2013-06-10 14:36:40 -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
Kenny Rachuonyo 4bd6e5e895 Update media.txt
Fixed typo: froms -> forms
2013-06-09 08:23:48 +03:00
Tim Graham 1fdc3d256d Fixed #20523 - Incorrect form field for FilePathField.
Thanks sane4ka.sh@ for the report.
2013-05-28 11:54:53 -04:00
Tim Graham 2fd61285d1 Fixed #20471 - Typos in topics/forms/formsets.txt 2013-05-20 13:56:19 -04:00
Ryan Kaskel 4280217f31 Fixed #20403 -- Ignore forms marked for deletion when validating max_num. 2013-05-20 12:13:21 -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
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
Thomas Thurman b47b0211f5 Corrected "it's" to "its" when used possessively.
Fixed #20327.
2013-04-29 17:21:37 +02:00
Juan Catalano 78c842a323 Adapted uses of versionchanged/versionadded to the new form.
Refs #20104.
2013-04-20 17:18:35 +02:00
Simon Charette 1de63cccb1 Fixed #20263 -- Corrected wording in the formset documentation.
Thanks to feraudyh at yahoo.com for the report.
2013-04-15 12:19:17 -04:00
Tim Graham 4a1d425cfe Fixed #8649 - Documented a caveat about dynamically adjusting formsets. 2013-03-31 04:34:28 -04: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 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
Alex Hunley 976dc07baf Removed a misleading examples from documentations ala ticket #19719 2013-02-16 14:30:55 -05:00
JonLoy 74003ca36b Fixed #19808 Capitalization error in example text 2013-02-12 09:14:19 -05:00
Tim Graham fdaaa24171 Fixed #19700 - Added documentation for BoundField.field.
Thanks Tiberiu Ana for the report and patch.
2013-02-02 08:34:42 -05: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
Tim Graham 067505ad19 Fixed broken links, round 4. refs #19516 2012-12-29 15:54:33 -05:00
Claude Paroz 8248d14029 Removed US localflavor-specific tests from core
Also fixes #9045.
2012-12-08 21:07:59 +01:00
Tim Graham d3fd8a1512 Fixed #15591 - Clarified interaction between ModelForm and model validation. 2012-11-05 18:24:28 -05:00
Tim Graham fd02bcff4a Fixed #18548 - Clarified note regarding reusing model instances when form validation fails. 2012-10-16 20:39:13 -04: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
Nick Martini 571698997f fixing modelforms example code, ticket #18832 2012-09-08 12:30:41 -04:00
Tim Graham e57338f2b9 Fixed #18847 - Updated for media examples to use static.example.com. Thanks Jamie Curle. 2012-08-24 08:23:50 -04:00
Tim Graham 3fd89d9903 Fixed #14885 - Clarified that ModelForm cleaning may not fully complete if the form is invalid.
Thanks Ben Sturmfels for the patch.
2012-08-21 17:32:53 -04:00
Tim Graham ebbc414d17 Fixed #16168 - Added note regarding type requirements when overridng ModelForm fields.
Thanks Pieter Swinkels for the patch.
2012-08-01 07:59:28 -04:00
Florian Apolloner 7d06f975fe Fixed #18614 -- Added missing imports in code samples. 2012-07-25 22:32:53 +02:00
Claude Paroz 19a810b18c Fixed #14917 -- Hinted that view should redirect after form post success 2012-06-23 18:47:52 +02:00
Jannis Leidel c4c7fbcc0d Fixed #18451 -- Vastly improved class based view documentation.
Many thanks to Daniel Greenfeld, James Aylett, Marc Tamlyn, Simon Williams, Danilo Bargen and Luke Plant for their work on this.
2012-06-11 10:40:23 +02:00
Audrey Roy 7ab6e32843 Revised the text in the 'Processing the data from a form' section. 2012-06-08 12:13:52 +02:00
Audrey Roy 3c05b500a5 Revised the text in the 'Using a form in a view' section. 2012-06-08 12:03:52 +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
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
Adrian Holovaty 6799ffad9a Merge pull request #99 from danielroseman/master
Docs: "Form in a view" example doesn't use RequestContext
2012-06-04 13:13:14 -07:00
Daniel Roseman 5c59e43aef Use render shortcut in form example. 2012-05-31 15:33:45 +01:00
Claude Paroz 6219591f2e Fixed #18244 -- Documented that formset.has_changed is a 1.4 addition. 2012-05-22 13:56:03 +02:00
Claude Paroz 596cb9c7e2 Replaced print statement by print function (forward compatibility syntax). 2012-04-30 20:45:03 +02: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
Adrian Holovaty 6ecadcbdd2 Made a bunch more edits up until [17418]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17428 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-03 20:45:45 +00:00
Ramiro Morales e308cfc0e1 Added support for specifying initial values to model formsets and inline formsets.
This make them consistent with the similar capability of regular
formsets. Thanks to simon29 form the report and to Claude Paroz for the
patch.

Fixes #14574.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17373 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-01-15 01:36:14 +00:00
Timo Graham f2d02647fa Fixed #16851 - Added how-to access form field value in template; thanks yasar11732 for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17138 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-11-21 23:33: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
Alex Gaynor 749f0721c4 Fixed #16985 -- corrected a few grammar errors in the docs.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16925 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-04 23:54:12 +00:00
Paul McMillan 4f109fcbff Fixed 11674 -- Clarified docs on excluded fields of ModelForms.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16875 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-22 04:52:43 +00:00
Julien Phalip 3513234cf8 Fixed #16815 -- Rectified the code example for hidden_fields and visible_fields in the forms documentation. Thanks, joonas.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16823 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-13 08:22:53 +00:00
Alex Gaynor d14bf8c62b Fixed #11404. Added ``FormSet.has_changed``, for consistancy with ``Form.has_changed``. Thanks to michelts for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16773 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-10 02:42:05 +00:00
Alex Gaynor 01b0eb50fd Make ``Formset.__getitem__`` O(1), rather than O(n). If you override ``__iter__`` you now need to also override ``__getitem__`` for consistant behavior. Thanks to Carl and Russ for the review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16770 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-10 01:53:56 +00:00
Gabriel Hurley bdd1409eea Fixed #16467 -- Restored a previously correct example which was broken in [16564]. Thanks to dmclain for pointing out that the original example was correct.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16623 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-18 21:47:04 +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 0350d65fa4 Fixed #16513 - Add forms import to example; thanks teraom.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16586 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-06 19:02:20 +00:00
Jannis Leidel 8ac23178ad Fixed #16467 -- Corrected formset code example. Thanks, teraom.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16564 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-07-29 09:40:22 +00:00