Commit ebb40704 by Tom Christie

Resolve TimeField representation for midnight value. (#4107)

parent 0795f739
......@@ -1191,7 +1191,7 @@ class TimeField(Field):
self.fail('invalid', format=humanized_format)
def to_representation(self, value):
if not value:
if value in (None, ''):
return None
output_format = getattr(self, 'format', api_settings.TIME_FORMAT)
......
......@@ -1063,7 +1063,8 @@ class TestTimeField(FieldValues):
'99:99': ['Time has wrong format. Use one of these formats instead: hh:mm[:ss[.uuuuuu]].'],
}
outputs = {
datetime.time(13, 00): '13:00:00',
datetime.time(13, 0): '13:00:00',
datetime.time(0, 0): '00:00:00',
'00:00:00': '00:00:00',
None: None,
'': None,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment