Feat: 템플릿 파일명을 근무처파일명_template.xlsx 에서 자동 로드
This commit is contained in:
5
app.py
5
app.py
@@ -679,6 +679,7 @@ def upload_workplaces():
|
|||||||
wp['id'] = f'p{offset}'
|
wp['id'] = f'p{offset}'
|
||||||
offset += 1
|
offset += 1
|
||||||
t['workplaces'] = existing + new_workplaces
|
t['workplaces'] = existing + new_workplaces
|
||||||
|
t['workplace_filename'] = file.filename
|
||||||
|
|
||||||
total = len(t['workplaces'])
|
total = len(t['workplaces'])
|
||||||
update_progress('완료', f'근무처 업로드 완료 (총 {total}개, 이번 {len(new_workplaces)}개)')
|
update_progress('완료', f'근무처 업로드 완료 (총 {total}개, 이번 {len(new_workplaces)}개)')
|
||||||
@@ -826,6 +827,10 @@ def export():
|
|||||||
ws.append([w['name'], w['hope'], w['address'], w['dob'], w['phone']])
|
ws.append([w['name'], w['hope'], w['address'], w['dob'], w['phone']])
|
||||||
|
|
||||||
elif export_type == 'assigned':
|
elif export_type == 'assigned':
|
||||||
|
wp_filename = t.get('workplace_filename', '')
|
||||||
|
base = os.path.splitext(wp_filename)[0]
|
||||||
|
template_path = f'{base}_template.xlsx' if base else ''
|
||||||
|
if not template_path or not os.path.exists(template_path):
|
||||||
template_path = '선거참관인_배치_와꾸_.xlsx'
|
template_path = '선거참관인_배치_와꾸_.xlsx'
|
||||||
if os.path.exists(template_path):
|
if os.path.exists(template_path):
|
||||||
wb = openpyxl.load_workbook(template_path)
|
wb = openpyxl.load_workbook(template_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user