# bug fixed: 日期空值判断

This commit is contained in:
xianfuxing 2018-08-08 17:02:19 +08:00
parent 9c870d7c1d
commit 0335c3b58b
1 changed files with 9 additions and 3 deletions

View File

@ -53,10 +53,16 @@ class DeviceInfoSerializer(serializers.ModelSerializer):
]
def get_compile_time(self, obj):
if obj.compile_time:
return obj.compile_time.strftime('%Y-%m-%d %H:%M:%S')
return None
def get_last_connect(self, obj):
if obj.last_connect:
return obj.last_connect.strftime('%Y-%m-%d %H:%M:%S')
return None
def get_last_offline_time(self, obj):
if obj.last_offline_time:
return obj.last_offline_time.strftime('%Y-%m-%d %H:%M:%S')
return None