开启导出表格功能

展示效果

代码

Web页面添加了导出功能,可以导出到csv了

class MyModelView(ModelView):
can_export = True
export_types = ['csv']

导出到excel

https://github.com/jazzband/tablib

pip install tablib[pandas]
import tablib

class MyModelView(ModelView):
can_export = True
export_types = ['xls']