﻿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
213	error submitting empty times	jkocherhans@…	Adrian Holovaty	"If I try to submit a datetime field in the admin interface, and the time is not provided (I'm setting disabled=true on the field with javascript), I get the following traceback:

Traceback (most recent call last):

  File ""/usr/local/lib/python2.4/site-packages/django/core/handlers/base.py"", line 63, in get_response
    return callback(request, **param_dict)

  File ""/usr/local/lib/python2.4/site-packages/django/views/admin/main.py"", line 767, in add_stage
    manipulator.do_html2python(new_data)

  File ""/opt/local/lib/python2.4/site-packages/django/core/formfields.py"", line 98, in do_html2python
    new_data.setlist(field.field_name, [field.__class__.html2python(None)])

  File ""/opt/local/lib/python2.4/site-packages/django/core/formfields.py"", line 654, in html2python
    time_tuple = time.strptime(data, '%H:%M:%S')

  File ""/usr/local/lib/python2.4/_strptime.py"", line 290, in strptime
    found = format_regex.match(data_string)

TypeError: expected string or buffer

Here's a diff against 331 that fixes the problem. (I don't know if this is a use-case you want to deal with, but the fix seems pretty trivial.)

Index: django/core/formfields.py
===================================================================
--- django/core/formfields.py   (revision 331)
+++ django/core/formfields.py   (working copy)
@@ -649,6 +649,8 @@
     def html2python(data):
         ""Converts the field into a datetime.time object""
         import time, datetime
+        if data is None:
+            return None
         try:
             try:
                 time_tuple = time.strptime(data, '%H:%M:%S')
"	defect	new	contrib.admin		normal				Unreviewed	0	0	0	0	0	0
