#34431 closed Cleanup/optimization (fixed)
DateTimeField.input_formats change from Django 3.1 is documented improperly
Reported by: | stefan6419846 | Owned by: | Edison Wang |
---|---|---|---|
Component: | Documentation | Version: | 3.1 |
Severity: | Normal | Keywords: | |
Cc: | Claude Paroz, Edison Wang | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
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.
Change History (8)
comment:1 by , 20 months ago
Cc: | added |
---|---|
Component: | Uncategorized → Documentation |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
comment:2 by , 20 months ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 20 months ago
Cc: | added |
---|
follow-up: 6 comment:5 by , 20 months ago
Has patch: | set |
---|
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?
comment:6 by , 20 months ago
Patch needs improvement: | set |
---|
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 classDateTimeFormatsIterator
to define the generator. Should this part be reverted?
get_format_lazy()
doesn't support multiple settings so DateTimeFormatsIterator
is necessary.
comment:7 by , 20 months ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Thanks for the report. We should update the docs.