mirror of
https://github.com/django/django.git
synced 2025-10-27 15:46:10 +00:00
Fixed #26104 -- Fixed TypeError when passing number to forms.DurationField.
This commit is contained in:
committed by
Tim Graham
parent
95648eb5c1
commit
956cde8004
@@ -488,7 +488,7 @@ class DurationField(Field):
|
||||
return None
|
||||
if isinstance(value, datetime.timedelta):
|
||||
return value
|
||||
value = parse_duration(value)
|
||||
value = parse_duration(force_str(value))
|
||||
if value is None:
|
||||
raise ValidationError(self.error_messages['invalid'], code='invalid')
|
||||
return value
|
||||
|
||||
Reference in New Issue
Block a user