summaryrefslogtreecommitdiff
path: root/django/forms/models.py
AgeCommit message (Collapse)Author
2020-10-27Fixed #1891, Fixed #11707 -- Prevented duplicates with limit_choices_to on ↵alvinshaita
multi-value relations.
2020-07-30Bumped minimum isort version to 5.1.0.David Smith
Fixed inner imports per isort 5. isort 5.0.0 to 5.1.0 was unstable.
2020-06-24Fixed #9061 -- Allowed FormSets to disable deleting extra forms.David Smith
Thanks to Dan Ward for the initial patch.
2020-06-05Fixed #20347 -- Allowed customizing the maximum number of instantiated forms ↵David Smith
in formsets. Co-authored-by: ethurgood <ethurgood@gmail.com>
2020-03-12Fixed #8760 -- Changed ModelMultipleChoiceField to use invalid_list as a ↵David Smith
error message key.
2020-02-05Fixed #26813 -- Prevented empty choice in ModelChoiceField with RadioSelect ↵Hasan Ramezani
for fields with blank=False.
2020-02-04Simplified imports from django.db and django.contrib.gis.db.Nick Pope
2019-12-23Fixed #30998 -- Added ModelChoiceIteratorValue to pass the model instance to ↵Jon Dufresne
ChoiceWidget.create_option().
2019-12-17Fixed #31086 -- Improved error message for admin model inlines with more ↵Shubham singh
than one foreign key to the same parent.
2019-11-28Refs #23919 -- Replaced super(...) with super() in metaclasses.Jon Dufresne
2019-10-11Fixed #30014 -- Fixed ModelChoiceField validation when initial value is a ↵Etienne Chové
model instance. Thanks Carlton Gibson for reviews.
2019-06-28Fixed #30400 -- Improved typography of user facing strings.Jon Dufresne
Thanks Claude Paroz for assistance with translations.
2019-06-20Added missing form argument in modelform_factory() docstring.Tobias Kunze
2019-06-04Fixed #30534 -- Fixed overriding a field's default in ModelForm.cleaned_data().RobertAKARobin
2019-04-03Fixed #30302 -- Fixed forms.model_to_dict() result if empty list of fields ↵belegnar
is passed.
2019-02-06Fixed #30159 -- Removed unneeded use of OrderedDict.Nick Pope
Dicts preserve order since Python 3.6.
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