django.utils.timezone returning naive date?

django, timezone

Solution

djangos putting in a default date value that isn't tz aware because the field isnt nullable by default. setting null to true means it will just set the date to to NULL instead so the warning isnt raised:

 date = models.DateTimeField(default=timezone.now, null=True)

Problem

using django 1.4 I have a model with a datetimefield. I imported django.utils.timezone to use as the default value. ``` from django.utils import timezone date = models.DateTimeField(default=timezone.now) ``` however I still receive the warning about DateTimeField received naive date. i have set USE_TZ to true so it should be returning aware datetimes

Original source

Related problems