def to_xlsform(self):
'''Generate an XLS format XLSForm copy of this form.'''
file_path= self.xls.name
default_storage= get_storage_class()()
if file_path != '' and default_storage.exists(file_path):
with default_storage.open(file_path) as xlsform_file:
if file_path.endswith('.csv'):
xlsform_io = convert_csv_to_xls(xlsform_file.read())
else:
xlsform_io= io.BytesIO(xlsform_file.read())
return xlsform_io
else:
return None
评论列表
文章目录