Przeglądaj źródła

时间格式化

wushaodong 4 lat temu
rodzic
commit
9cd3764b69

+ 5 - 0
apps/agent/serializers.py

@@ -7,6 +7,8 @@ from utils.booleancharfield import BooleanCharField
 
 class AgentSerializer(serializers.ModelSerializer):
     create_user_text = serializers.CharField(source='create_user.name', read_only=True)
+    create_time_f = serializers.DateTimeField(source='create_time', format=settings.SHORT_DATETIME_FORMAT,
+                                              read_only=True)
 
     class Meta:
         model = Agent
@@ -34,6 +36,9 @@ class StoreSerializer(serializers.ModelSerializer):
     check_user_text = serializers.CharField(source='check_user.name', read_only=True)
     agent_text = serializers.CharField(source='agent.name', read_only=True)
     enable_text = BooleanCharField(source='enable', read_only=True)
+    create_time_f = serializers.DateTimeField(source='create_time', format=settings.SHORT_DATETIME_FORMAT,
+                                              read_only=True)
+    check_time_f = serializers.DateTimeField(source='check_time', format=settings.SHORT_DATETIME_FORMAT, read_only=True)
 
     class Meta:
         model = Store

+ 1 - 1
uis/views/agent/index.html

@@ -115,7 +115,7 @@
                 , {field: 'area', title: '区域', width: 200}
                 , {field: 'address', title: '地址', width: 200}
                 , {field: 'create_user_text', title: '添加人', width: 100}
-                , {field: 'create_time', title: '添加时间', width: 180}
+                , {field: 'create_time_f', title: '添加时间', width: 180}
                 , {field: 'notes', title: '备注', width: 200}
                 , {width: 150, align: 'center', fixed: 'right', toolbar: '#agent-operate-bar'}
             ]]

+ 2 - 2
uis/views/store/index.html

@@ -115,13 +115,13 @@
                 {field: 'name', title: '名称', width: 150}
                 , {field: 'address', title: '地址', width: 200}
                 , {field: 'create_user_text', title: '添加人', width: 140}
-                , {field: 'create_time', title: '添加时间', width: 160}
+                , {field: 'create_time_f', title: '添加时间', width: 160}
                 , {field: 'end_date', title: '到期日期', width: 150}
                 , {field: 'agent_text', title: '代理商', width: 120}
                 , {field: 'enable_text', title: '是否在用', width: 100}
                 , {field: 'status_text', title: '状态', width: 100}
                 , {field: 'check_user_text', title: '审核人', width: 120}
-                , {field: 'check_time', title: '审核时间', width: 180}
+                , {field: 'check_time_f', title: '审核时间', width: 180}
                 , {field: 'notes', title: '备注', width: 200}
                 , {width: 170, align: 'center', fixed: 'right', toolbar: '#store-operate-bar'}
             ]]