|
|
@@ -1,7 +1,7 @@
|
|
|
#coding=utf-8
|
|
|
'''
|
|
|
'''
|
|
|
-import os
|
|
|
+import os,re
|
|
|
import json,time,datetime
|
|
|
import shutil
|
|
|
import tempfile
|
|
|
@@ -1401,6 +1401,7 @@ def download_zip(request):
|
|
|
tpl_1 = os.path.join(root,"apply_template_tzzy.docx")
|
|
|
tpl_2 = os.path.join(root,"apply_template_aqxy.docx")
|
|
|
tpl_3 = os.path.join(root,"apply_template_cyry.docx")
|
|
|
+ tpl_4 = os.path.join(root,"apply_template_tzsb.docx")
|
|
|
files = []
|
|
|
for o in qset:
|
|
|
subject_item = o.subject_item
|
|
|
@@ -1408,11 +1409,14 @@ def download_zip(request):
|
|
|
doc = DocxTemplate(tpl_1)
|
|
|
elif u"负责人" in subject_item:
|
|
|
doc = DocxTemplate(tpl_2)
|
|
|
+ elif u"特种设备" in subject_item:
|
|
|
+ doc = DocxTemplate(tpl_4)
|
|
|
else:
|
|
|
doc = DocxTemplate(tpl_3)
|
|
|
subject_item0 = o.subject_item.split("|")[0]
|
|
|
subject_item1 = o.subject_item.split("|")[1]
|
|
|
subject_item2 = o.subject_item.split("|")[2]
|
|
|
+ subject_item_code = re.search(r"\w+",subject_item2).group()
|
|
|
fname = u"{}_{}.docx".format(o.name,subject_item2)
|
|
|
#fname = u"{}.docx".format(o.name)
|
|
|
#fname = unicode(fname,"utf-8")
|
|
|
@@ -1426,7 +1430,7 @@ def download_zip(request):
|
|
|
halfbody_img = o.halfbody_img.replace(settings.HOST,settings.STATIC_ROOT) if o.halfbody_img else None
|
|
|
context = {"name":o.name,"sex":o.sex,"education":o.education,"idno":o.idno,"class_id":o.class_id,
|
|
|
"company":o.company,"phone":o.phone,"train_type":o.train_type,"subject_item1":subject_item1,
|
|
|
- "subject_item2":subject_item2,"train_time_start":o.train_time_start,
|
|
|
+ "subject_item2":subject_item2,"train_time_start":o.train_time_start,"subject_item_code":subject_item_code,
|
|
|
"train_time_end":o.train_time_end,"birthday":birthday,
|
|
|
"idnoimg_face":InlineImage(doc,idnoimg_face,height=Mm(82.5),width=Mm(140.66)),
|
|
|
"idnoimg_back":InlineImage(doc,idnoimg_back,height=Mm(82.5),width=Mm(140.66)),
|