1. Luke Plant
  2. south


Andrew Godwin  committed a5c1750

Fix #483 (invalid freezing of safe_datetime)

  • Participants
  • Parent commits b417a13
  • Branches default

Comments (0)

Files changed (1)

File south/modelsinspector.py

View file
 from django.utils.functional import Promise
 from django.contrib.contenttypes import generic
 from django.utils.datastructures import SortedDict
+from django.utils import datetime_safe
 NOISY = False
     # Make sure Decimal is converted down into a string
     if isinstance(value, decimal.Decimal):
         value = str(value)
+    # datetime_safe has an improper repr value
+    if isinstance(value, datetime_safe.datetime):
+        value = datetime.datetime(*value.utctimetuple()[:7])
+    if isinstance(value, datetime_safe.date):
+        value = datetime.date(*value.timetuple()[:3])
     # Now, apply the converter func if there is one
     if "converter" in options:
         value = options['converter'](value)