Generate CSV reports by simply creating SQL views.
Authenticated staff members can then directly download these reports as CSV. It’s a nice agile way to deal with the changing requirements for reports.
Quick start
Include the URLconf in your project urls.py like this:
url(r'^reports/', include('view_export.urls')),Create an SQL view in your database:
=> CREATE VIEW v_staff_names AS ( -> SELECT first_name, last_name FROM auth_user -> WHERE is_staff = TRUE);You’ll probably want to record this SQL in a file such as reports.sql or even better, add it to a Django migration.
Start the development server and visit http://127.0.0.1:8000/reports/view-export/staff_names/ or http://127.0.0.1:8000/reports/view-export/v_staff_names/ to download the SQL view named v_staff as a CSV file.
No settings are required by default and there’s no need to add the package to Django’s INSTALLED_APPS. Staff login access is required, so you may wish to set the LOGIN_URL setting to /admin/login/ initially.
Release History
0.7.1 (2017-02-07)
remove patterns 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)
Bugfixes
Fix installation error due to HISTORY.rst not being present in source.
0.6.1 (2015-08-25)
Improvements
Switch to Python 3 only, factor out CSV and report filename generation.
0.5.5 (2015-08-25)
Bugfixes
Fix installation error due to HISTORY.rst not being present in source.
0.5.4 (2015-08-09)
Bugfixes
Fix SQL injection vulnerability relating to “view” argument.
0.5.3 (2015-08-05)
Improvements
Update documentation.
Rename PyPI package to django-view-export.
Release files for django-view-export 0.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-view-export-0.7.1.tar.gz | 4.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_view_export-0.7.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.3 kB
Release files / django-view-export-0.7.1.tar.gz
| Download URL | django-view-export-0.7.1.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d3379d341c0caf2384e5007bb01d84c2325186a13aeb903bea92ce748c068cd9
|
|
BLAKE2b-256 checksum How to use checksums |
3db3ec8874e91b700a985fd1bf34e19be479fe0c92edca207bef019574521259
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_view_export-0.7.1-py3-none-any.whl
| Download URL | django_view_export-0.7.1-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4fb6546e3f93cfff1c7bd5aaa9e5f1b7e412ff1f43ced8e275235d3bc9caac8b
|
|
BLAKE2b-256 checksum How to use checksums |
c21b7912af08f405556571cefc7c400d2ae8d21b04840f2aa2473247325878cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |