def response(self): '''导出选中数据到excel中 ''' id_li = self.info_ids.split(',') sheet_text = ZdZookeeper.select().where(ZdZookeeper.id << id_li) sheet_title = [ { 'name': '集群名称' }, { 'name': '集群配置' }, { 'name': '集群业务' }, ] bind_attr = ( 'cluster_name', 'hosts', 'business', ) ewb = ExcelWorkBook() sheet_name = ZdZookeeper._meta.db_table ewb.add_sheet(sheet_name) ewb.add_title(sheet_name, sheet_title) ewb.add_text(sheet_name, sheet_text, bind=bind_attr) filename = '{}.xls'.format(sheet_name) filename = urllib.urlencode({'filename': filename}) self.set_header('Content-Disposition', 'attachment;{}'.format(filename)) self.finish(ewb.get_stream())
def response(self): '''导出选中数据到excel中 ''' id_li = self.info_ids.split(',') sheet_text = ZdQconfAgent.select().where(ZdQconfAgent.id << id_li) sheet_title = [ { 'name': 'ip' }, { 'name': '主机名' }, { 'name': '说明' }, ] bind_attr = ( 'ip', 'hostname', 'notes', ) ewb = ExcelWorkBook() sheet_name = ZdQconfAgent._meta.db_table ewb.add_sheet(sheet_name) ewb.add_title(sheet_name, sheet_title) ewb.add_text(sheet_name, sheet_text, bind=bind_attr) filename = '{}.xls'.format(sheet_name) filename = urllib.urlencode({'filename': filename}) self.set_header('Content-Disposition', 'attachment;{}'.format(filename)) self.finish(ewb.get_stream())
def response(self): """导出选中数据到excel中 """ id_li = self.info_ids.split(",") sheet_text = ZdQconfAgent.select().where(ZdQconfAgent.id << id_li) sheet_title = [{"name": "ip"}, {"name": "主机名"}, {"name": "说明"}] bind_attr = ("ip", "hostname", "notes") ewb = ExcelWorkBook() sheet_name = ZdQconfAgent._meta.db_table ewb.add_sheet(sheet_name) ewb.add_title(sheet_name, sheet_title) ewb.add_text(sheet_name, sheet_text, bind=bind_attr) filename = "{}.xls".format(sheet_name) filename = urllib.urlencode({"filename": filename}) self.set_header("Content-Disposition", "attachment;{}".format(filename)) self.finish(ewb.get_stream())
def response(self): '''导出选中数据到excel中 ''' id_li = self.info_ids.split(',') sheet_text = ZdZookeeper.select().where(ZdZookeeper.id << id_li) sheet_title = [ {'name': '集群名称'}, {'name': '集群配置'}, {'name': '集群业务'}, ] bind_attr = ( 'cluster_name', 'hosts', 'business', ) ewb = ExcelWorkBook() sheet_name = ZdZookeeper._meta.db_table ewb.add_sheet(sheet_name) ewb.add_title(sheet_name, sheet_title) ewb.add_text(sheet_name, sheet_text, bind=bind_attr) filename = '{}.xls'.format(sheet_name) filename = urllib.urlencode({'filename': filename}) self.set_header('Content-Disposition', 'attachment;{}'.format(filename)) self.finish(ewb.get_stream())
def response(self): '''导出选中数据到excel中 ''' id_li = self.info_ids.split(',') sheet_text = ZdQconfAgent.select().where(ZdQconfAgent.id << id_li) sheet_title = [ {'name': 'ip'}, {'name': '主机名'}, {'name': '说明'}, ] bind_attr = ( 'ip', 'hostname', 'notes', ) ewb = ExcelWorkBook() sheet_name = ZdQconfAgent._meta.db_table ewb.add_sheet(sheet_name) ewb.add_title(sheet_name, sheet_title) ewb.add_text(sheet_name, sheet_text, bind=bind_attr) filename = '{}.xls'.format(sheet_name) filename = urllib.urlencode({'filename': filename}) self.set_header('Content-Disposition', 'attachment;{}'.format(filename)) self.finish(ewb.get_stream())