summaryrefslogtreecommitdiff
path: root/django/forms/models.py
AgeCommit message (Collapse)Author
2019-01-01Fixed #29981 -- Fixed inline formsets with a OnetoOneField primary key that ↵Patrik Sletmo
uses to_field.
2018-08-21Fixed #29696 -- Prevented BaseModelFormSet.initial_form_count()'s from ↵Jon Dufresne
treating data={} as unbound.
2018-07-30Fixed #26819 -- Fixed BaseModelFormSet.validate_unique() "unhashable type: ↵Demur Nodia
list" crash.
2018-06-07Fixed #29474 -- Simplified BaseInlineFormset.save_new().Tim Graham
2018-04-23Refs #28312 -- Added an optimized __bool__() to ModelChoiceIterator.François Freitag
COUNT is more expensive than EXISTS; use the latter when possible.
2018-04-23Fixed #28312 -- Made ModelChoiceIterator.__len__() more memory-efficient.François Freitag
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-03-31Fixed #29279 -- Added renderer argument to ModelForm.Dan Watson
2018-03-01Fixed #29159 -- Made ModelChoiceIterator reuse QuerySet result cache.François Freitag
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-01Fixed #29158 -- Fixed len(choices) crash if ModelChoiceField's queryset is a ↵François Freitag
manager. Removing all() in __iter__() prevents a duplicate query when choices are cast to a list and there's a prefetch_related().
2018-01-12Fixed #28996 -- Simplified some boolean constructs and removed trivial ↵Дилян Палаузов
continue statements.
2018-01-03Fixed #28985 -- Removed unneeded None checks before hasattr().Дилян Палаузов
2017-12-11Fixed #28909 -- Simplified code using tuple/list/set/dict unpacking.Nick Pope
2017-12-04Fixed #28860 -- Removed unnecessary len() calls.Дилян Палаузов
2017-09-13Removed unnecessary parens in various code.Mariusz Felisiak
2017-09-13Merged isinstance() calls.Mariusz Felisiak
2017-09-07Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."Tim Graham
This reverts commit 550cb3a365dee4edfdd1563224d5304de2a57fda because try/except performs better.
2017-07-29Avoided creation of temporary sets.Sergey Fedoseev
2017-07-14Fixed #28387 -- Fixed has_changed() for disabled form fields that subclass it.Srinivas Reddy Thatiparthy
2017-07-11Fixed #22229 -- Added primary key validation to ↵Jon Dufresne
BaseModelFormSet._construct_form().
2017-06-30Fixed #28345 -- Applied limit_choices_to during ModelForm.__init__().Jon Dufresne
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-28Fixed #27818 -- Replaced try/except/pass with contextlib.suppress().Mads Jensen
2017-06-10Refs #23919 -- Replaced stray super(ClassName, self) with super().Tom
2017-06-03Fixed #28192 -- Required passing optional form field args as keyword args.Claude Paroz
2017-06-01Refs #23968 -- Removed unnecessary lists, generators, and tuple calls.Jon Dufresne
2017-05-27Fixed #28249 -- Removed unnecessary dict.keys() calls.Jon Dufresne
iter(dict) is equivalent to iter(dict.keys()).
2017-05-03Fixed #28159 -- Fixed BaseInlineFormSet._construct_form() crash when using ↵Alexander Kavanaugh
save_as_new. Regression in 4a246a02bdcbc13b15480c014f51cb0682af7c1e.
2017-04-27Refs #27795 -- Replaced many force_text() with str()Claude Paroz
Thanks Tim Graham for the review.
2017-03-22Fixed #27975 -- Fixed crash if ModelChoiceField's queryset=None.James Beith
Regression in 9153d8fbd6385db9f48793662de789fc3d686841.
2017-03-20Fixed #27957 -- Removed technical terms from ↵Jon Dufresne
InlineForeignKeyField/ModelMultipleChoiceField error messages.
2017-03-15Refs #27563 -- Fixed ModelChoiceField.__deepcopy__() so forms don't share a ↵Tim Graham
queryset cache. Thanks Luke Benstead for the report Simon Charettes for the fix.
2017-02-20Refs #27656 -- Updated django.forms/http docstring verbs according to PEP 257.Anton Samarchyan
2017-02-07Converted usage of ugettext* functions to their gettext* aliasesClaude Paroz
Thanks Tim Graham for the review.
2017-02-01Refs #23919 -- Replaced kwargs.pop() with keyword-only arguments.Vytis Banaitis
2017-01-25Refs #23919 -- Replaced super(ClassName, self) with super().chillaranand
2017-01-19Refs #23919 -- Removed str() conversion of type and method __name__.Simon Charette
2017-01-19Refs #23919 -- Stopped inheriting from object to define new style classes.Simon Charette
2017-01-18Refs #23919 -- Removed most of remaining six usageClaude Paroz
Thanks Tim Graham for the review.
2017-01-18Refs #23919 -- Removed six.<various>_types usageClaude Paroz
Thanks Tim Graham and Simon Charette for the reviews.
2017-01-18Refs #23919 -- Removed encoding preambles and future importsClaude Paroz
2016-12-06Fixed #27416 -- Prevented ModelFormSet from creating objects for invalid PKs ↵Hiroki Kiyohara
in data.
2016-12-02Fixed #27563 -- Moved "apply limit_choices_to" code from BaseModelForm to ↵Jon Dufresne
fields_for_model().
2016-09-22Fixed #27186 -- Fixed model form default fallback for MultiWidget, ↵Tim Graham
FileInput, SplitDateTimeWidget, SelectDateWidget, and SplitArrayWidget. Thanks Matt Westcott for the review.
2016-09-03Replaced smart_* by force_* calls whenever possibleClaude Paroz
The smart_* version should only be used when a lazy string should keep its lazy status.
2016-09-01Refs #27039 -- Fixed regression with field defaults in prefixed forms.Alex Hill
2016-08-24Fixed #27039 -- Fixed empty data fallback to model field default in model forms.Tim Graham
2016-07-30Fixed #26970 -- Fixed crash with disabled ModelMultipleChoiceField.Tim Graham
2016-06-09Fixed #26734 -- Made iterator class configurable on ModelChoiceField.David Sanders
2016-05-11Refs #24227 -- Removed ManyToManyField special casing in model_to_dict().Tim Graham
2016-04-26Fixed #21332, #26538 -- Fixed inconsistent and duplicate form fields on ↵David Sanders
inline formsets.
2016-04-21Fixed #22383 -- Added support for HTML5 required attribute on required form ↵Jon Dufresne
fields.