[Django] #21074: DateTimeField: Using localized_fields breaks timezone conversion

4 views
Skip to first unread message

Django

unread,
Sep 9, 2013, 4:52:49 AM9/9/13
to django-...@googlegroups.com
#21074: DateTimeField: Using localized_fields breaks timezone conversion
-------------------------------+-----------------------------------------
Reporter: mattaustin | Owner: nobody
Type: Uncategorized | Status: new
Component: Forms | Version: 1.6-beta-1
Severity: Normal | Keywords: timezone localization forms
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+-----------------------------------------
If I add a DateTimeField to the form's {{{localized_fields}}} Meta
property (in order to get the date correctly formatted), then the rendered
field value is no longer converted to the activated timezone. This also
occurs when setting {{{localized=True}}} on the DateTimeField.

Using Django 1.6b2.

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

Django

unread,
Sep 9, 2013, 4:55:29 AM9/9/13
to django-...@googlegroups.com
#21074: DateTimeField: Using localized_fields breaks timezone conversion
-------------------------------------+-------------------------------------
Reporter: mattaustin | Owner: aaugustin
Type: Bug | Status: assigned
Component: Forms | Version:
Severity: Normal | 1.6-beta-1
Keywords: timezone | Resolution:
localization forms | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* status: new => assigned
* needs_better_patch: => 0
* needs_tests: => 0
* owner: nobody => aaugustin
* needs_docs: => 0
* type: Uncategorized => Bug
* stage: Unreviewed => Accepted


Comment:

I wasn't aware of `localized_fields`. I'll look into it.

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

Django

unread,
Sep 21, 2013, 3:19:51 PM9/21/13
to django-...@googlegroups.com
#21074: DateTimeField: Using localized_fields breaks timezone conversion
-------------------------------------+-------------------------------------
Reporter: mattaustin | Owner:
Type: Bug | Status: new
Component: Forms | Version:
Severity: Release blocker | 1.6-beta-1

Keywords: timezone | Resolution:
localization forms | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* status: assigned => new
* owner: aaugustin =>
* severity: Normal => Release blocker


Comment:

There's a good reason why I didn't know about `localized_fields`: they're
a new feature in 1.6.

The corresponding ticket is #13546 and the commit is [756b81db].

Since it's a major bug in a new feature, I'm marking the ticket as a
release blocker.

Since it isn't a bug in my code, I'm deassigning myself.

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

Django

unread,
Sep 21, 2013, 4:02:36 PM9/21/13
to django-...@googlegroups.com
#21074: DateTimeField: Using localized_fields breaks timezone conversion
-------------------------------------+-------------------------------------
Reporter: mattaustin | Owner: aaugustin
Type: Bug | Status: assigned
Component: Forms | Version:
Severity: Normal | 1.6-beta-1

Keywords: timezone | Resolution:
localization forms | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* owner: => aaugustin


* status: new => assigned

* severity: Release blocker => Normal


Comment:

Florian rightfully points out that, if the bug can be triggered by setting
`localize=True` on a `DateTimeField`, it isn't new in 1.6. I'll have to
deal with it.

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

Django

unread,
Sep 21, 2013, 4:08:12 PM9/21/13
to django-...@googlegroups.com
#21074: DateTimeField: Using localized_fields breaks timezone conversion
-------------------------------------+-------------------------------------
Reporter: mattaustin | Owner: aaugustin
Type: Bug | Status: assigned
Component: Forms | Version:
Severity: Release blocker | 1.6-beta-1

Keywords: timezone | Resolution:
localization forms | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* severity: Normal => Release blocker


Comment:

Phew, it's actually a regression in 1.6 introduced in
893d8de6f5d0b6bf23e2ed072e18fe2e012395c6.

Florian and I independently identified this commit through bisection.

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

Django

unread,
Sep 21, 2013, 4:57:52 PM9/21/13
to django-...@googlegroups.com
#21074: DateTimeField: Using localized_fields breaks timezone conversion
-------------------------------------+-------------------------------------
Reporter: mattaustin | Owner: aaugustin
Type: Bug | Status: assigned
Component: Forms | Version:
Severity: Release blocker | 1.6-beta-1
Keywords: timezone | Resolution:
localization forms | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Florian Apolloner <florian@…>):

In [changeset:"56743cf9e337826e4c615909570bb057142a6a7b"]:
{{{
#!CommitTicketReference repository=""
revision="56743cf9e337826e4c615909570bb057142a6a7b"
Ensured that BoundField.as_widget always returns properly localized
fields.

This is a follow-up to #18777 which improperly converted to strings in
prepare_value and as such caused regressions like #21074.

Refs #18777, #21074
}}}

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

Django

unread,
Sep 21, 2013, 4:58:52 PM9/21/13
to django-...@googlegroups.com
#21074: DateTimeField: Using localized_fields breaks timezone conversion
-------------------------------------+-------------------------------------
Reporter: mattaustin | Owner: aaugustin
Type: Bug | Status: assigned
Component: Forms | Version:
Severity: Release blocker | 1.6-beta-1
Keywords: timezone | Resolution:
localization forms | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Florian Apolloner <florian@…>):

In [changeset:"ece8d6521771635fb5e15d1093524b4f848608fa"]:
{{{
#!CommitTicketReference repository=""
revision="ece8d6521771635fb5e15d1093524b4f848608fa"
[1.6.x] Ensured that BoundField.as_widget always returns properly
localized fields.

This is a follow-up to #18777 which improperly converted to strings in
prepare_value and as such caused regressions like #21074.

Refs #18777, #21074

Backport of 56743cf9e337826e4c615909570bb057142a6a7b from master.
}}}

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

Django

unread,
Sep 21, 2013, 5:11:24 PM9/21/13
to django-...@googlegroups.com
#21074: DateTimeField: Using localized_fields breaks timezone conversion
-------------------------------------+-------------------------------------
Reporter: mattaustin | Owner: aaugustin
Type: Bug | Status: closed

Component: Forms | Version:
Severity: Release blocker | 1.6-beta-1
Keywords: timezone | Resolution: fixed

localization forms | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Aymeric Augustin <aymeric.augustin@…>):

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


Comment:

In [changeset:"e76dd4cd1a12f610698b8aa8854b0e0e1dfb21a2"]:
{{{
#!CommitTicketReference repository=""
revision="e76dd4cd1a12f610698b8aa8854b0e0e1dfb21a2"
[1.6.x] Fixed #21074 -- Added tests for localized datetime fields.

Fields must render values in the current time zone.

This commit only contains tests because this ticket was just a symptom of
a regression from #18777 that was fixed separately.

Backport of 5444a9c from master.
}}}

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

Django

unread,
Sep 21, 2013, 5:11:24 PM9/21/13
to django-...@googlegroups.com
#21074: DateTimeField: Using localized_fields breaks timezone conversion
-------------------------------------+-------------------------------------
Reporter: mattaustin | Owner: aaugustin
Type: Bug | Status: closed
Component: Forms | Version:
Severity: Release blocker | 1.6-beta-1
Keywords: timezone | Resolution: fixed
localization forms | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Aymeric Augustin <aymeric.augustin@…>):

In [changeset:"5444a9c68353d8108df1cf69c9557740d626a18d"]:
{{{
#!CommitTicketReference repository=""
revision="5444a9c68353d8108df1cf69c9557740d626a18d"


Fixed #21074 -- Added tests for localized datetime fields.

Fields must render values in the current time zone.

This commit only contains tests because this ticket was just a symptom of
a regression from #18777 that was fixed separately.
}}}

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

Reply all
Reply to author
Forward
0 new messages