Commit Graph

854 Commits

Author SHA1 Message Date
Shubham singh ffcf1a8ebf Fixed #31118 -- Made FileInput to avoid the required attribute when initial data exists. 2020-01-08 09:15:31 +01:00
Claude Paroz 188b003014 Fixed #15982 -- Added DATE_INPUT_FORMATS to forms.DateTimeField default input formats. 2020-01-07 11:08:40 +01:00
Claude Paroz 1487f16f2d Fixed #11385 -- Made forms.DateTimeField accept ISO 8601 date inputs.
Thanks José Padilla for the initial patch, and Carlton Gibson for the
review.
2020-01-06 10:52:09 +01:00
Jon Dufresne 67ea35df52 Fixed #30998 -- Added ModelChoiceIteratorValue to pass the model instance to ChoiceWidget.create_option(). 2019-12-23 10:34:50 +01:00
Shubham singh f4647179cc Fixed #31086 -- Improved error message for admin model inlines with more than one foreign key to the same parent. 2019-12-17 09:15:01 +01:00
Jon Dufresne e703b93a65 Fixed #31080 -- Removed redundant type="text/javascript" attribute from <script> tags. 2019-12-11 09:49:54 +01:00
Peter Andersen 02eff7ef60 Fixed #31073 -- Prevented CheckboxInput.get_context() from mutating attrs. 2019-12-10 12:27:50 +01:00
Jon Dufresne 86a0231e0a Refs #23919 -- Replaced super(...) with super() in metaclasses. 2019-11-28 15:34:29 +01:00
Carlton Gibson ee4a19053a Fixed #31012 -- Reverted "Fixed #29056 -- Fixed HTML5 validation of required SelectDateWidget."
This reverts commit f038214d91.

The initial issue was incorrect. Django 2.2, and before, did not
generate invalid HTML as reported. With f03821 in place invalid HTML
was generated.

Thanks to Kevin Brown for follow-up report and investigation.
2019-11-21 20:53:31 +01:00
Jon Dufresne 77aa74cb70 Refs #29983 -- Added support for using pathlib.Path in all settings. 2019-11-07 10:26:22 +01:00
Hasan Ramezani e3d0b4d550 Fixed #30899 -- Lazily compiled import time regular expressions. 2019-10-29 09:22:26 +01:00
Etienne Chové e7cdb0cd7e Fixed #30014 -- Fixed ModelChoiceField validation when initial value is a model instance.
Thanks Carlton Gibson for reviews.
2019-10-11 13:28:09 +02:00
Hasan Ramezani a28d1b38e5 Fixed #30839 -- Fixed Field.__deepcopy__() so forms don't share error messages. 2019-10-08 10:07:05 +02:00
Mads Jensen 129583a0d3 Removed some outdated backwards compatibility imports and misleading comments.
EmptyResultSet moved in 46509cf13d.
FieldDoesNotExist moved in 8958170755.
BoundField and pretty_name moved in 8550161e53.
EMPTY_VALUES moved in 471596fc1a.
BaseRunserverCommand moved in 5c53e30607.
2019-09-24 15:18:53 +02:00
Jon Dufresne d89053585e Improved error message when index in __getitem__() is invalid. 2019-07-23 20:12:08 +02:00
Jon Dufresne 42b9a23267 Fixed #30400 -- Improved typography of user facing strings.
Thanks Claude Paroz for assistance with translations.
2019-06-28 16:46:18 +02:00
Shubham Bhagat 26d16c07fd Fixed #30578 - Made SelectDateWidget respect a custom date format when USE_L10N is disabled. 2019-06-26 11:07:11 +02:00
Tobias Kunze a387ef1117 Added missing form argument in modelform_factory() docstring. 2019-06-20 15:13:22 +02:00
RobertAKARobin aa94f7c899 Fixed #30534 -- Fixed overriding a field's default in ModelForm.cleaned_data(). 2019-06-04 08:28:49 +02:00
Hasan Ramezani f038214d91 Fixed #29056 -- Fixed HTML5 validation of required SelectDateWidget.
placeholder is required for "select" with "required" attribute.
2019-05-08 12:46:30 +02:00
Jon Dufresne 8b3f1c35dd Removed unnecessary assignments in various code. 2019-04-24 13:09:29 +02:00
Ville Skyttä 03db5fddfd Fixed typos in docs, comments, and exception messages. 2019-04-18 09:33:53 +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
Hasan Ramezani 5fc5d93512 Fixed #29956 -- Allowed overriding an order field widget in formsets. 2019-03-21 11:51:01 +01:00
Andra Denis Ionescu 4c086d7da4 Fixed #29459 -- Initialized form data/files with empty MultiValueDicts. 2019-03-05 10:41:08 -05:00
Matthias Kestenholz 231b513926 Fixed #30179 -- Fixed form Media merging when pairwise merging is insufficient.
Thanks gasman for the tests, and codingjoe and timgraham for the review.
2019-02-27 16:39:17 -05:00
Matthias Kestenholz 959d0c078a Fixed #30153 -- Fixed incorrect form Media asset ordering after three way merge.
Delaying merging assets as long as possible avoids introducing
incorrect relative orderings that cause a broken final result.
2019-02-09 09:38:52 -05:00
Sergey Fedoseev 1933e56eca Removed uneeded generator expressions and list comprehensions. 2019-02-09 09:18:48 -05:00
Nick Pope 24b82cd201 Fixed #30159 -- Removed unneeded use of OrderedDict.
Dicts preserve order since Python 3.6.
2019-02-06 13:48:39 -05:00
Tim Graham 0004daa536
Used 4 space hanging indent for dictionaries.
Thanks Mariusz Felisiak for auditing.
2019-01-02 18:18:19 -05:00
Patrik Sletmo 14e2b1b065 Fixed #29981 -- Fixed inline formsets with a OnetoOneField primary key that uses to_field. 2019-01-01 10:40:22 -05:00
Basil Dubyk 35a08b8541 Fixed #17210 -- Made NullBooleanSelect use unknown/true/false as query data. 2018-11-14 13:43:34 -05:00
Sergey Fedoseev 54b331451c Refs #29689 -- Moved FilePathField choices sorting outside the loop. 2018-08-29 06:19:32 -04:00
Jon Dufresne ef87b38ef7 Fixed #29696 -- Prevented BaseModelFormSet.initial_form_count()'s from treating data={} as unbound. 2018-08-21 10:02:03 -04:00
Federico Bond a0ca4b5694 Fixed #29689 -- Improved performance of FileSystemStorage.listdir() and FilePathField with os.scandir(). 2018-08-20 17:58:00 -04:00
Tim Graham 838d6dcb86 Refs #29426 -- Made UUIDField render values with dashes. 2018-08-18 08:20:21 -04:00
Tim Graham 730173d1c5 Fixed #29623 -- Fixed translation failure of DurationField's "overflow" error message. 2018-08-08 06:24:52 -04:00
Demur Nodia 06a11ef6ec Fixed #26819 -- Fixed BaseModelFormSet.validate_unique() "unhashable type: list" crash. 2018-07-30 16:52:12 -04:00
Tim Graham 236bcfea42 Fixed #29474 -- Simplified BaseInlineFormset.save_new(). 2018-06-07 21:14:19 -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
Tom 11b8c30b9e Ref #23919 -- Replaced some os.path usage with pathlib.Path. 2018-04-19 21:30:00 -04:00
safu9 9fd9f8bbb2 Fixed #29284 -- Made ImageField render with accept="image/*"' HTML attribute. 2018-04-04 13:16:03 -04:00
Claude Paroz f3b69f9757 Fixed #29273 -- Prevented initial selection of empty choice in multiple choice widgets.
Regression in b52c73008a.
2018-04-02 08:52:53 -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
Tim Graham 87dc0844a6 Fixed #29200 -- Fixed label rendering when using RadioSelect and CheckboxSelectMultiple with MultiWidget. 2018-03-15 09:10:23 -04:00
Daniel Hahler 683341db43 Condensed some widgets code. 2018-03-03 13:35:09 -05: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