mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-29 13:04:03 +03:00
updated timefield also
This commit is contained in:
parent
81775dfbae
commit
fc08236ab8
|
@ -1186,6 +1186,9 @@ class TimeField(Field):
|
|||
self.fail('invalid', format=humanized_format)
|
||||
|
||||
def to_representation(self, value):
|
||||
if not value:
|
||||
return None
|
||||
|
||||
output_format = getattr(self, 'format', api_settings.TIME_FORMAT)
|
||||
|
||||
if output_format is None:
|
||||
|
|
|
@ -1030,7 +1030,9 @@ 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, 00): '13:00:00',
|
||||
None: None,
|
||||
'': None,
|
||||
}
|
||||
field = serializers.TimeField()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user