Perhaps I wasn't clear. I know *what* Django does with timezone-aware 
dates. I just want to know *how* it does the conversion from the UTC-stored 
datetime in the DB to the localtime-displayed datetime in the templates. 
Which function(s) does the template system call to do the conversion?

On Wednesday, August 3, 2016 at 1:49:45 PM UTC-7, Constantine Covtushenko 
wrote:
>
> Hi Robert,
>
> You have touched a very simple but always confusing questions - storing 
> dates and showing them to users in different places.
>
> As I know Django uses that in very straightforward way.
> It always converts dates to UTC.
> Flow that converts them back to different users in different time-zones is 
> adjusted through settings.
>
> Please check settings for your testing environment.
> More information you can find on that `i18` documentation page 
> <https://docs.djangoproject.com/en/1.9/topics/i18n/>.
>
> Regards,
> I hope that helps.
>
>
> On Wed, Aug 3, 2016 at 11:36 PM, Robert Rollins <coredu...@gmail.com 
> <javascript:>> wrote:
>
>> I'm writing tests that assert dates are being properly rendered on a 
>> certain page, but the tests are failing because the date value on the model 
>> object is in UTC, and the date is rendered in local time on the template. 
>> I'd like to run that date value through the same mechanism by which the 
>> template converts it to local time, so that my test does the same thing as 
>> the template.
>>
>> I've looked around, and unfortunately been unable to find the code that 
>> does the automatic conversion. The "date" template filter doesn't do it, 
>> and I'm too ignorant of the nitty gritty details of django template system 
>> to know what else I should be looking for. 
>>
>> Any help would be appreciated.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com <javascript:>.
>> To post to this group, send email to django...@googlegroups.com 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/b4f5a0d6-8aea-47a9-969e-45c7a407a104%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/b4f5a0d6-8aea-47a9-969e-45c7a407a104%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/540c4257-7c82-434a-98a6-ab0fed40478f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to