[Django] #34431: DateTimeField.input_formats change from Django 3.1 is documented improperly

4 views
Skip to first unread message

Django

unread,
Mar 23, 2023, 4:32:09 AM3/23/23
to django-...@googlegroups.com
#34431: DateTimeField.input_formats change from Django 3.1 is documented improperly
-----------------------------------------+------------------------
Reporter: stefan6419846 | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 3.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-----------------------------------------+------------------------
In
https://github.com/django/django/commit/188b003014dc727ca22f7fafb21cf2fa0b3472d2,
`django.forms.fields.DateTimeField.input_formats` has been changed to be a
generator instead of the previous list. This type change does not seem to
have been documented anywhere, leading to unexpected errors during
migration and does not match the type of the `input_formats` for the other
datetime-related fields.

--
Ticket URL: <https://code.djangoproject.com/ticket/34431>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 24, 2023, 3:08:05 AM3/24/23
to django-...@googlegroups.com
#34431: DateTimeField.input_formats change from Django 3.1 is documented improperly
--------------------------------------+------------------------------------
Reporter: stefan6419846 | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 3.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* cc: Claude Paroz (added)
* type: Uncategorized => Cleanup/optimization
* component: Uncategorized => Documentation
* stage: Unreviewed => Accepted


Comment:

Thanks for the report. We should update the docs.

--
Ticket URL: <https://code.djangoproject.com/ticket/34431#comment:1>

Django

unread,
Mar 26, 2023, 6:28:39 PM3/26/23
to django-...@googlegroups.com
#34431: DateTimeField.input_formats change from Django 3.1 is documented improperly
-------------------------------------+-------------------------------------
Reporter: stefan6419846 | Owner:
Type: | edisonwang03
Cleanup/optimization | Status: assigned

Component: Documentation | Version: 3.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by edisonwang03):

* owner: nobody => edisonwang03
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/34431#comment:2>

Django

unread,
Mar 27, 2023, 9:42:14 PM3/27/23
to django-...@googlegroups.com
#34431: DateTimeField.input_formats change from Django 3.1 is documented improperly
-------------------------------------+-------------------------------------
Reporter: stefan6419846 | Owner: Edison
Type: | Wang

Cleanup/optimization | Status: assigned
Component: Documentation | Version: 3.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Edison Wang):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/34431#comment:3>

Django

unread,
Mar 27, 2023, 9:42:32 PM3/27/23
to django-...@googlegroups.com
#34431: DateTimeField.input_formats change from Django 3.1 is documented improperly
-------------------------------------+-------------------------------------
Reporter: stefan6419846 | Owner: Edison
Type: | Wang
Cleanup/optimization | Status: assigned
Component: Documentation | Version: 3.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Edison Wang):

* cc: Edison Wang (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/34431#comment:4>

Django

unread,
Mar 27, 2023, 10:46:51 PM3/27/23
to django-...@googlegroups.com
#34431: DateTimeField.input_formats change from Django 3.1 is documented improperly
-------------------------------------+-------------------------------------
Reporter: stefan6419846 | Owner: Edison
Type: | Wang
Cleanup/optimization | Status: assigned
Component: Documentation | Version: 3.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Edison Wang):

* has_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/34431#comment:5>

Django

unread,
Mar 29, 2023, 12:35:48 AM3/29/23
to django-...@googlegroups.com
#34431: DateTimeField.input_formats change from Django 3.1 is documented improperly
-------------------------------------+-------------------------------------
Reporter: stefan6419846 | Owner: Edison
Type: | Wang
Cleanup/optimization | Status: assigned
Component: Documentation | Version: 3.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Edison Wang):

* has_patch: 0 => 1


Comment:

Link to pull request: [https://github.com/django/django/pull/16698]

I also updated the documentation for TimeField and DateField because the
{{{input_formats}}} attribute for both fields are also generators since
they are lazily evaluated.

I believe that the changes made to
{{{django.forms.fields.DateTimeField.input_formats}}} from
[https://github.com/django/django/commit/188b003014dc727ca22f7fafb21cf2fa0b3472d2]
are redundant. The previous initialization is already lazily evaluated, so
there is no need to include the class {{{DateTimeFormatsIterator}}} to
define the generator. Should this part be reverted?

Django

unread,
Mar 29, 2023, 2:50:31 AM3/29/23
to django-...@googlegroups.com
#34431: DateTimeField.input_formats change from Django 3.1 is documented improperly
-------------------------------------+-------------------------------------
Reporter: stefan6419846 | Owner: Edison
Type: | Wang
Cleanup/optimization | Status: assigned
Component: Documentation | Version: 3.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


Comment:

> I believe that the changes made to
{{{django.forms.fields.DateTimeField.input_formats}}} from
[https://github.com/django/django/commit/188b003014dc727ca22f7fafb21cf2fa0b3472d2]
are redundant. The previous initialization is already lazily evaluated, so
there is no need to include the class {{{DateTimeFormatsIterator}}} to
define the generator. Should this part be reverted?

`get_format_lazy()` doesn't support multiple settings so
`DateTimeFormatsIterator` is necessary.

--
Ticket URL: <https://code.djangoproject.com/ticket/34431#comment:6>

Django

unread,
Apr 3, 2023, 12:59:23 AM4/3/23
to django-...@googlegroups.com
#34431: DateTimeField.input_formats change from Django 3.1 is documented improperly
-------------------------------------+-------------------------------------
Reporter: stefan6419846 | Owner: Edison
Type: | Wang
Cleanup/optimization | Status: assigned
Component: Documentation | Version: 3.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/34431#comment:7>

Django

unread,
Apr 3, 2023, 2:15:04 AM4/3/23
to django-...@googlegroups.com
#34431: DateTimeField.input_formats change from Django 3.1 is documented improperly
-------------------------------------+-------------------------------------
Reporter: stefan6419846 | Owner: Edison
Type: | Wang
Cleanup/optimization | Status: closed
Component: Documentation | Version: 3.1
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"cbcc1240e912cfc47cb6ea0c4fe6b4a48f36f7e2" cbcc1240]:
{{{
#!CommitTicketReference repository=""
revision="cbcc1240e912cfc47cb6ea0c4fe6b4a48f36f7e2"
Fixed #34431 -- Improved Date/DateTimeField/TimeField.input_formats docs.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34431#comment:8>

Django

unread,
Apr 3, 2023, 2:15:39 AM4/3/23
to django-...@googlegroups.com
#34431: DateTimeField.input_formats change from Django 3.1 is documented improperly
-------------------------------------+-------------------------------------
Reporter: stefan6419846 | Owner: Edison
Type: | Wang
Cleanup/optimization | Status: closed
Component: Documentation | Version: 3.1
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"9ef2625cd51f6f84d6268322b1f8e59b99b35aac" 9ef2625c]:
{{{
#!CommitTicketReference repository=""
revision="9ef2625cd51f6f84d6268322b1f8e59b99b35aac"
[4.2.x] Fixed #34431 -- Improved
Date/DateTimeField/TimeField.input_formats docs.

Backport of cbcc1240e912cfc47cb6ea0c4fe6b4a48f36f7e2 from main
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34431#comment:9>

Reply all
Reply to author
Forward
0 new messages