Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added a missing warning forgotten in r17392.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17393 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 0907233040fa0fe48185f2eb650dd677bdeb7878 1 parent 8f16897
Jannis Leidel authored January 24, 2012

Showing 1 changed file with 7 additions and 0 deletions. Show diff stats Hide diff stats

  1. 7  django/db/models/fields/__init__.py
7  django/db/models/fields/__init__.py
@@ -750,6 +750,13 @@ def to_python(self, value):
750 750
         if isinstance(value, datetime.date):
751 751
             value = datetime.datetime(value.year, value.month, value.day)
752 752
             if settings.USE_TZ:
  753
+                # For backwards compatibility, interpret naive datetimes in
  754
+                # local time. This won't work during DST change, but we can't
  755
+                # do much about it, so we let the exceptions percolate up the
  756
+                # call stack.
  757
+                warnings.warn(u"DateTimeField received a naive datetime (%s)"
  758
+                              u" while time zone support is active." % value,
  759
+                              RuntimeWarning)
753 760
                 default_timezone = timezone.get_default_timezone()
754 761
                 value = timezone.make_aware(value, default_timezone)
755 762
             return value

0 notes on commit 0907233

Please sign in to comment.
Something went wrong with that request. Please try again.