导出数据库视图的csv报告。
django-view-export的Python项目详细描述
只需创建sql视图即可生成csv报告。
经过认证的工作人员可以直接下载这些报告作为csv。 这是一种很好的敏捷方法来处理不断变化的报表需求。
快速启动
在项目中包含urlconf urls.py,如下所示:
url(r'^reports/',include('view_export.urls')),
在数据库中创建SQL视图:
=>CREATEVIEWv_staff_namesAS(->SELECTfirst_name,last_nameFROMauth_user->WHEREis_staff=TRUE);
您可能希望将此sql记录在诸如reports.sql或 更好的是,将它添加到django迁移中。
启动开发服务器并访问http://127.0.0.1:8000/reports/view-export/staff_names/ 或者http://127.0.0.1:8000/reports/view-export/v_staff_names/下载名为 v_staff作为csv文件。
默认情况下不需要设置,也不需要将包添加到 Django的^{TT6}$。员工登录权限是必需的,因此您可能希望 最初将LOGIN_URL设置设置为/admin/login/。
发布历史记录
0.7.1(2017-02-07)
- remove ^{tt9}$ URLconf function per deprecation in Django 1.8
- fix example URLs in README
- provide example view with underscores
- document staff-only access and LOGIN_URL setting
0.6.2(2015-09-04)
错误修复
- Fix installation error due to HISTORY.rst not being present in source.
0.6.1(2015-08-25)
改进
- Switch to Python 3 only, factor out CSV and report filename generation.
0.5.5(2015-08-25)
错误修复
- Fix installation error due to HISTORY.rst not being present in source.
0.5.4(2015-08-09)
错误修复
- Fix SQL injection vulnerability relating to “view” argument.
0.5.3(2015-08-05)
改进
- Update documentation.
- Rename PyPI package to ^{tt10}$.