Code

#20045 closed Uncategorized (invalid)

template timezone datetimefields with auto_now_add, auto_now

Reported by: rpq Owned by: nobody
Component: Template system Version: 1.5
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The instructions found at ​https://docs.djangoproject.com/en/1.4/topics/i18n/timezones/#time-zone-aware-output-in-templates indicate that datetime aware fields on a model displayed on a template should automatically display in the current time zone. I use TIME_ZONE set to 'UTC' and change the current time zone with activate() for users in different time zones.

When displaying my DateTimeFields (created_at and updated_at) created with auto_now and auto_now_add, the template displays the datetime fields in UTC regardless of what time zone is set using activate() and localtime filter has no effect on them. All the other DateTimeFields not created with auto_now and auto_now_add are displaying in the template as expected in the current timezone.

Help?

Attachments (0)

Change History (3)

comment:1 Changed 16 months ago by rpq

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Version changed from 1.4 to 1.5

I should mention that using the timezone filter to force the conversion works on these datetime fields.

comment:2 Changed 16 months ago by rpq

Please close this as invalid. It turns out user's timezone was not properly set.

comment:3 Changed 16 months ago by rpq

  • Resolution set to invalid
  • Status changed from new to closed

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.