﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
557	date_hierarchy doesn't work with DateField	kyrrigle@…	Adrian Holovaty	"Trying to use a DateField in the meta.Admin(date_hierarch=""dateFld"") yields the following exception when going to the admin list page:

{{{
  File ""/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/django/core/db/typecasts.py"", line 23, in typecast_timestamp
    d, t = s.split()
}}}

A simple patch to make typecast_timestamp work with just dates is:

{{{
===================================================================
--- django/core/db/typecasts.py (revision 687)
+++ django/core/db/typecasts.py (working copy)
@@ -20,7 +20,12 @@
     # ""2005-07-29 15:48:00.590358-05""
     # ""2005-07-29 09:56:00-05""
     if not s: return None
-    d, t = s.split()
+    flds = s.split()
+    d = flds[0]
+    if len(flds) == 1:
+        t = ""00:00:01""  # or noon?
+    else:
+        t = flds[1]
     # Extract timezone information, if it exists. Currently we just throw
     # it away, but in the future we may make use of it.
     if '-' in t:
}}}

"	defect	closed	contrib.admin		normal	fixed		kyrrigle@…	Unreviewed	0	0	0	0	0	0
