1
0
mirror of https://github.com/django/django.git synced 2025-10-25 14:46:09 +00:00

Fixed #24339 -- Fixed crash with empty DurationField form field.

This commit is contained in:
Michael Angeletti
2015-02-13 17:12:23 -05:00
committed by Tim Graham
parent 1791a7e75a
commit 8a21d25033
2 changed files with 12 additions and 2 deletions

View File

@@ -514,7 +514,8 @@ class DurationField(Field):
}
def prepare_value(self, value):
return duration_string(value)
if isinstance(value, datetime.timedelta):
return duration_string(value)
def to_python(self, value):
if value in self.empty_values: