Пример #1
0
 def post(self, request, *args, **kwargs):
     uploaded_file = request.FILES['file']
     file_name = uploaded_file.name
     upload_cloud = UploadCloudStorage(uploaded_file)
     cloud_uri = upload_cloud.upload()
     if not cloud_uri:
         raise FastResponse('上传失败, 请重试')
     path = f'{settings.STATIC_FILE_API_PREFIX}{cloud_uri}'
     url = urljoin(settings.HTTPS_HOST, path)
     upload_time = time_util.time2str(datetime.datetime.now())
     upload_info = {
         'name': file_name,
         'url': url,
         'location': url,
         'upload_time': upload_time
     }
     return JsonResponse(data=upload_info)
Пример #2
0
 def req_time_render(self):
     return time2str(self.req_time)
Пример #3
0
 def updated_time_render(self):
     if self.updated_time:
         return time2str(self.updated_time)
     return None
Пример #4
0
 def rectification_time_render(self):
     if self.rectification_time:
         return time2str(self.rectification_time)
     return '-'
Пример #5
0
 def actual_deadline_render(self):
     if self.actual_deadline:
         return time2str(self.actual_deadline)
     return '-'
Пример #6
0
 def expect_deadline_render(self):
     return time2str(self.expect_deadline)
Пример #7
0
 def operate_time_render(self):
     return time2str(self.operate_time)