From 762280875647f9122377ea39eb18093898524959 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 29 Sep 2020 10:30:16 +0800 Subject: [PATCH] update xlsx --- server/apps/ability/views.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/server/apps/ability/views.py b/server/apps/ability/views.py index 169e495..889a6f2 100644 --- a/server/apps/ability/views.py +++ b/server/apps/ability/views.py @@ -10,7 +10,6 @@ import zipfile import rarfile from openpyxl import Workbook, load_workbook from django.db.models import Count -import time # Create your views here. class CMAViewSet(ModelViewSet): """ @@ -50,7 +49,7 @@ class CMAViewSet(ModelViewSet): import os if fullpath.endswith('.rar'): rar = rarfile.RarFile(fullpath) - fulldir = fullpath.replace('.rar',time.strftime('%Y%m%d%H%M%S')) + fulldir = fullpath.replace('.rar','') os.mkdir(fulldir) os.chdir(fulldir) rar.extractall() @@ -62,7 +61,7 @@ class CMAViewSet(ModelViewSet): import_cma(f, os.path.join(root,f)) return Response('不支持非xlsx格式', status = status.HTTP_400_BAD_REQUEST) elif fullpath.endswith('.zip'): - fulldir = fullpath.replace('.zip',time.strftime('%Y%m%d%H%M%S')) + fulldir = fullpath.replace('.zip','') os.mkdir(fulldir) os.chdir(fulldir) CMA.objects.filter(type='center').delete() @@ -85,7 +84,7 @@ class CMAViewSet(ModelViewSet): import os if fullpath.endswith('.rar'): rar = rarfile.RarFile(fullpath) - fulldir = fullpath.replace('.rar',time.strftime('%Y%m%d%H%M%S')) + fulldir = fullpath.replace('.rar','') os.mkdir(fulldir) os.chdir(fulldir) rar.extractall() @@ -97,7 +96,7 @@ class CMAViewSet(ModelViewSet): import_cma2(f, os.path.join(root,f)) return Response('不支持非xlsx格式', status = status.HTTP_400_BAD_REQUEST) elif fullpath.endswith('.zip'): - fulldir = fullpath.replace('.zip',time.strftime('%Y%m%d%H%M%S')) + fulldir = fullpath.replace('.zip','') os.mkdir(fulldir) os.chdir(fulldir) # CMA.objects.filter(type='sub').delete()