Jon Dufresne
8d76443aba
Fixed #30399 -- Changed django.utils.html.escape()/urlize() to use html.escape()/unescape().
2019-04-25 15:09:07 +02:00
belegnar
1ffddfc233
Fixed #30302 -- Fixed forms.model_to_dict() result if empty list of fields is passed.
2019-04-03 09:05:15 +02:00
belegnar
714cf468e1
Refs #30302 -- Added more tests for forms.model_to_dict().
2019-04-03 08:59:08 +02:00
Tim Graham
0004daa536
Used 4 space hanging indent for dictionaries.
...
Thanks Mariusz Felisiak for auditing.
2019-01-02 18:18:19 -05:00
Matt Wiens
e817ae74da
Followed style guide for model attribute ordering.
2018-12-27 19:34:14 -05:00
Manan
3a4558b84f
Moved choices inside of test models per coding style.
2018-12-10 09:28:49 -05:00
Simon Charette
84e7a9f4a7
Switched setUp() to setUpTestData() where possible in Django's tests.
2018-11-27 09:35:17 -05:00
Tim Graham
193c109327
Switched TestCase to SimpleTestCase where possible in Django's tests.
2018-11-27 08:58:44 -05:00
Carlton Gibson
1c05fe65f2
Refs #13091 -- Added test for commit=False idiom with partial unique_together validation.
2018-07-25 18:39:35 -04:00
François Freitag
d1413c5d70
Refs #28312 -- Added an optimized __bool__() to ModelChoiceIterator.
...
COUNT is more expensive than EXISTS; use the latter when possible.
2018-04-23 13:03:07 -04:00
François Freitag
3fca95e1ad
Fixed #28312 -- Made ModelChoiceIterator.__len__() more memory-efficient.
...
Instead of loading all QuerySet results in memory, count the number of
entries. This adds an extra query when list() or tuple() is called on the
choices (because both call __len__() then __iter__()) but uses less
memory since the QuerySet results won't be cached. In most cases, the
choices will only be iterated on, meaning that __len__() won't be called
and only one query will be executed.
2018-04-23 12:39:43 -04:00
Dan Watson
e163effecc
Fixed #29279 -- Added renderer argument to ModelForm.
2018-03-31 20:45:59 -04:00
Mariusz Felisiak
362813d628
Fixed hanging indentation in various code.
2018-03-16 10:54:34 +01:00
François Freitag
a2e97abd81
Fixed #29159 -- Made ModelChoiceIterator reuse QuerySet result cache.
...
When __len__() is called (e.g. when casting to list or tuple), the
QuerySet is evaluated and the result cache populated. iterator()
shouldn't be called on the QuerySet after that, as it would reset the
result cache and trigger a second query.
2018-03-01 14:17:56 -05:00
François Freitag
40f0aa9885
Fixed #29158 -- Fixed len(choices) crash if ModelChoiceField's queryset is a manager.
...
Removing all() in __iter__() prevents a duplicate query when choices are
cast to a list and there's a prefetch_related().
2018-03-01 14:12:14 -05:00
François Freitag
06172d7bc2
Consolidated ModelChoiceField tests.
2018-03-01 14:05:35 -05:00
Tim Graham
3fb718f17d
Eliminated the need to modify a model forms test when new test files are added.
2018-02-28 10:26:26 -05:00
Jon Dufresne
ff05de760c
Fixed #29038 -- Removed closing slash from HTML void tags.
2018-01-21 02:09:10 -05:00
Jon Dufresne
47d238b696
Fixed #29041 -- Changed SelectMultiple's multiple attribute to HTML5 boolean syntax.
2018-01-20 11:19:06 -05:00
Tim Graham
e5bd585c6e
Fixed #28543 -- Prevented ManyToManyField.value_from_object() from being lazy.
...
Previously, it was a QuerySet which could reevaluate to a new value if the
model's data changes. This is inconsistent with other Field.value_from_object()
methods.
This allows reverting the fix in the admin for refs #27998 .
2017-08-31 09:34:44 -04:00
Mads Jensen
a51c4de194
Used assertRaisesMessage() to test Django's error messages.
2017-07-29 19:07:23 -04:00
Srinivas Reddy Thatiparthy
5debbdfcc8
Fixed #28387 -- Fixed has_changed() for disabled form fields that subclass it.
2017-07-14 13:06:51 -04:00
Jon Dufresne
a1be12fe19
Fixed #28345 -- Applied limit_choices_to during ModelForm.__init__().
...
field_for_model() now has an additional keyword argument,
apply_limit_choices_to, allowing it to continue to be used to create
form fields dynamically after ModelForm.__init__() is called.
Thanks Tim Graham for the review.
2017-06-30 15:57:48 -07:00
Tom
3eb3907bb1
Refs #23919 -- Replaced stray super(ClassName, self) with super().
2017-06-10 20:46:43 -04:00
Manatsawin Hanmongkolchai
a0c07d77fc
Fixed #28242 -- Moved ImageField file extension validation to the form field.
2017-06-01 10:13:23 -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
heathervm
7d1e237753
Fixed #27993 -- Fixed model form default fallback for SelectMultiple.
2017-03-31 10:10:08 -04:00
James Beith
216bb2e8fb
Fixed #27975 -- Fixed crash if ModelChoiceField's queryset=None.
...
Regression in 9153d8fbd6385db9f48793662de789fc3d686841.
2017-03-22 08:51:12 -04:00
Mariusz Felisiak
2767ef3ca7
Fixed nondeterministic ordering test failure in model_forms.
2017-03-16 11:14:51 -04:00
Tim Graham
44f9241c48
Refs #27563 -- Fixed ModelChoiceField.__deepcopy__() so forms don't share a queryset cache.
...
Thanks Luke Benstead for the report Simon Charettes for the fix.
2017-03-15 12:54:26 -04:00
Tim Graham
d6e26e5b7c
Removed obsolete references to form_for_instance().
2017-02-28 07:37:25 -05:00
Vytis Banaitis
3dcc351691
Refs #23919 -- Used yield from.
2017-02-23 20:06:01 -05:00
Jon Dufresne
6d8979f4c2
Fixed #27758 -- Reallowed AdvancedModelIterator pattern after template widget rendering.
2017-01-31 09:41:51 -05:00
chillaranand
d6eaf7c018
Refs #23919 -- Replaced super(ClassName, self) with super().
2017-01-25 12:23:46 -05:00
Tim Graham
4e729feaa6
Refs #23919 -- Removed django.utils._os.upath()/npath()/abspathu() usage.
...
These functions do nothing on Python 3.
2017-01-20 08:01:02 -05:00
Simon Charette
9695b14982
Refs #23919 -- Removed str() conversion of type and method __name__.
2017-01-19 11:31:07 -05:00
Simon Charette
cecc079168
Refs #23919 -- Stopped inheriting from object to define new style classes.
2017-01-19 08:39:46 +01:00
Claude Paroz
2b281cc35e
Refs #23919 -- Removed most of remaining six usage
...
Thanks Tim Graham for the review.
2017-01-18 21:33:28 +01: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
f3c43ad1fd
Refs #23919 -- Removed python_2_unicode_compatible decorator usage
2017-01-18 13:44:34 +01:00
Claude Paroz
d7b9aaa366
Refs #23919 -- Removed encoding preambles and future imports
2017-01-18 09:55:19 +01:00
Tim Graham
bcf3532ede
Refs #26154 -- Removed deprecated CommaSeparatedIntegerField.
2017-01-17 20:52:02 -05:00
Josef Rousek
aaecf038ca
Fixed #27370 -- Prevented Select widget from using 'required' with a non-empty first value.
2016-12-28 10:45:22 -05:00
Preston Timmons
b52c73008a
Fixed #15667 -- Added template-based widget rendering.
...
Thanks Carl Meyer and Tim Graham for contributing to the patch.
2016-12-27 17:50:10 -05:00
Tim Graham
7ed456063b
Updated LimitChoicesToTests to use setUpTestData and cosmetic edits.
2016-12-02 14:46:52 -05:00
Jon Dufresne
6abd6c598e
Fixed #27563 -- Moved "apply limit_choices_to" code from BaseModelForm to fields_for_model().
2016-12-02 08:40:24 -08:00
za
321e94fa41
Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings.
2016-11-10 21:30:21 -05:00
Michal Petrucha
09da1e79de
Fixed #27369 -- Prevented widgets from being shared between form field instances.
2016-11-06 07:16:56 +01:00
Tim Graham
2f9861d823
Fixed #27148 -- Fixed ModelMultipleChoiceField crash with invalid UUID.
2016-10-31 15:21:05 -04:00
Tim Graham
87c5e7efeb
Refs #27186 -- Fixed model form default fallback for CheckboxSelectMultiple.
2016-09-30 14:49:50 -04:00