导入的时候导入自己的公司

This commit is contained in:
caoqianming 2020-11-23 17:55:02 +08:00
parent 2b1cc50486
commit c0131e1c60
1 changed files with 2 additions and 6 deletions

View File

@ -84,15 +84,11 @@ def drquestions(companyid,path,userid):
right = sheet['j'+str(i)].value.replace(' ', '')
resolution = sheet['k'+str(i)].value
level = sheet['l'+str(i)].value
objs = Questioncat.objects.filter(usecomp__partid=1,name=cate,deletemark=1)
objs = Questioncat.objects.filter(usecomp__partid=companyid,name=cate,deletemark=1)
if objs.exists():
cateobj = objs[0]
else:
objs = Questioncat.objects.filter(usecomp__partid=companyid,name=cate,deletemark=1)
if objs.exists():
cateobj = objs[0]
else:
cateobj = Questioncat.objects.create(usecomp=Partment.objects.get(partid=companyid),name=cate)
cateobj = Questioncat.objects.create(usecomp=Partment.objects.get(partid=companyid),name=cate)
if type == '单选':
if Question.objects.filter(type=1,title=title,right=right,deletemark=1,usecomps = ','+companyid+',').exists():
Question.objects.filter(type=1,title=title,right=right,deletemark=1,usecomps = ','+companyid+',').update(nousecomps='', questioncat=cateobj)