Commit Graph

46 Commits

Author SHA1 Message Date
Jon Dufresne d7881d2020 Fixed #22229 -- Added primary key validation to BaseModelFormSet._construct_form(). 2017-07-11 14:33:21 -04:00
Jon Dufresne 988309a1ae Added ModelFormSet test for validation of a nonexistent PK. 2017-07-11 14:28:56 -04:00
Jon Dufresne 21046e7773 Fixed #28249 -- Removed unnecessary dict.keys() calls.
iter(dict) is equivalent to iter(dict.keys()).
2017-05-27 19:08:46 -04:00
Alexander Kavanaugh 362fba87c9 Fixed #28159 -- Fixed BaseInlineFormSet._construct_form() crash when using save_as_new.
Regression in 4a246a02bd.
2017-05-03 07:45:51 -04:00
chillaranand d6eaf7c018 Refs #23919 -- Replaced super(ClassName, self) with super(). 2017-01-25 12:23:46 -05:00
Claude Paroz 7b2f2e74ad Refs #23919 -- Removed six.<various>_types usage
Thanks Tim Graham and Simon Charette for the reviews.
2017-01-18 20:18:46 +01:00
Claude Paroz d7b9aaa366 Refs #23919 -- Removed encoding preambles and future imports 2017-01-18 09:55:19 +01:00
Hiroki Kiyohara 181f492ad0 Fixed #27416 -- Prevented ModelFormSet from creating objects for invalid PKs in data. 2016-12-06 13:06:58 -05:00
za 321e94fa41 Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings. 2016-11-10 21:30:21 -05: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
Adam Chainz 652bcc6f5f Refs #25415 -- Fixed invalid models in the test suite. 2016-09-09 17:16:42 -04:00
Jon Dufresne 4f336f6652 Fixed #26747 -- Used more specific assertions in the Django test suite. 2016-06-16 14:19:18 -04:00
Jon Dufresne ec6121693f Fixed #22383 -- Added support for HTML5 required attribute on required form fields. 2016-04-21 19:16:38 -04:00
Tim Graham 92053acbb9 Fixed E128 flake8 warnings in tests/. 2016-04-08 10:12:33 -04: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
Dražen Odobašić b1e33ceced Fixed #23395 -- Limited line lengths to 119 characters. 2015-09-12 11:40:50 -04:00
Stanislas Guerra 4c2f546b55 Fixed #24395 -- Ensured inline ModelsForms have an updated related instance. 2015-02-24 11:49:00 -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
Adam Taylor 039465a6a7 Fixed typos in code comments. 2015-01-20 12:18:03 -05:00
Berker Peksag f7969b0920 Fixed #23620 -- Used more specific assertions in the Django test suite. 2014-11-03 11:56:37 -05:00
Petras Zdanavičius f7eee04ebe Fixed #23451 -- Fixed typo in inlineformset_factory() error message. 2014-09-08 17:22:23 -04:00
Alex Gaynor 1dcc603eff Fixed several typos in Django 2014-05-28 17:39:14 -07: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
Anders Steinlein 4ef10f245a Fixed #17642 -- Added min_num support to modelformsets, inlines, and the admin.
Thanks Stephen Burrows for work on the patch as well.

Forwardport of 2914f66983 from stable/1.7.x
2014-05-15 07:25:35 -04:00
Aymeric Augustin cff59bedc2 Split ignores_nulls_in_unique_constraints feature.
Oracle and SQL Server don't have exactly the same limitations. It's
worth treating them differently.
2014-05-08 22:11:20 +02: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
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
Levi Gross 0dd9075622
Fixed unittest typo 2013-12-25 12:18:14 -05:00
coagulant 3bc0d46a84 Fixed all E261 warnings 2013-11-02 18:20:39 -04:00
Ole Laursen f4f01fb03c Fixed #18508 -- tests for repeated deletion bug in ModelFormSet
The ticket's issue was already fixed by patch for #14877.
2013-10-31 19:39:10 +02:00
Alasdair Nicol c3aa2948c6 Fixed #21298 -- Fixed E301 pep8 warnings 2013-10-23 13:45:03 +01:00
Tim Graham 1597503a01 Fixed E221 pep8 warnings. 2013-10-22 09:51:39 -04:00
Tim Graham 96d1d4e292 Removed unused local variables in tests. 2013-10-19 08:31:38 -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 65e03a424e Fixed #10284 -- ModelFormSet.save(commit=False) no longer deletes objects
Thanks laureline.guerin@ and Wedg.
2013-07-23 16:21:23 -04: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 a521d10322 Fixed a couple form/formset deprecation warnings in tests. 2013-07-01 09:36:31 -04: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
Loic Bistuer 9e50833e22 Fixed #20000 -- Allowed ModelForm meta overrides for label, help_text and error_messages 2013-06-13 15:06:25 -04: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
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 3318595c0b Fixed #18898 -- Added tests with a fix for ModelMultipleChoiceField 2013-03-01 09:35:18 +01:00
Florian Apolloner 89f40e3624 Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00