From f114130891353592909f96876307e4c33d771862 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Mon, 6 Jul 2020 17:50:25 +0800 Subject: [PATCH] update --- server/apps/ability/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/apps/ability/views.py b/server/apps/ability/views.py index 8203f85..5d4b806 100644 --- a/server/apps/ability/views.py +++ b/server/apps/ability/views.py @@ -88,7 +88,7 @@ class CMAViewSet(ModelViewSet): os.chdir(fulldir) rar.extractall() rar.close() - CMA.objects.filter(type='sub').delete() + # CMA.objects.filter(type='sub').delete() for root, dirs, files in os.walk(fulldir): for f in files: if f.endswith('.xls'): @@ -98,7 +98,7 @@ class CMAViewSet(ModelViewSet): fulldir = fullpath.replace('.zip','') os.mkdir(fulldir) os.chdir(fulldir) - CMA.objects.filter(type='sub').delete() + # CMA.objects.filter(type='sub').delete() with zipfile.ZipFile(fullpath,'r') as zzz: zzz.extractall(fulldir) for root, dirs, files in os.walk(fulldir): @@ -220,6 +220,8 @@ def import_cma2(filename, path): sheet = wb.worksheets[0] datalist = [] sszx = filename.split('-')[0] + if CMA.objects.filter(sszx=sszx, type='sub').exists(): + CMA.objects.filter(sszx=sszx, type='sub').delete() i = 3 max_row = sheet.max_row while i