{ "info": { "author": "Chris Adams", "author_email": "cadams@loc.gov", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Django", "Framework :: Django :: 1.8", "Framework :: Django :: 1.9", "Intended Audience :: Developers", "License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5" ], "description": "=====================\ndjango-tabular-export\n=====================\n\n.. image:: https://landscape.io/github/LibraryOfCongress/django-tabular-export/master/landscape.svg\n :target: https://landscape.io/github/LibraryOfCongress/django-tabular-export/master\n :alt: Landscape.io Code Quality\n\n.. image:: https://travis-ci.org/LibraryOfCongress/django-tabular-export.png?branch=master\n :target: https://travis-ci.org/LibraryOfCongress/django-tabular-export\n\n.. image:: https://readthedocs.org/projects/django-tabular-export/badge/?version=latest\n :target: http://django-tabular-export.readthedocs.org/en/latest/?badge=latest\n :alt: Documentation Status\n\nSimple spreadsheet exports from Django 1.8+\n\nDocumentation\n-------------\n\nThis module contains functions which take (headers, rows) pairs and return HttpResponses with either XLSX or\nCSV downloads and Django admin actions which can be added to any ModelAdmin for generic exports. It provides\ntwo functions (``export_to_csv_response`` and ``export_to_xlsx_response``) which take a filename,\na list of column headers, and a Django ``QuerySet``, list-like object, or generator and return a response.\n\nGoals\n~~~~~\n\n* This project is not intended to be a general-purpose spreadsheet manipulation library. The only goal is to\n export data quickly and safely.\n* The API is intentionally simple, giving you full control over the display and formatting of headers or your\n data. ``flatten_queryset`` has special handling for only two types of data: ``None`` will be converted to an\n empty string and ``date`` or ``datetime`` instances will serialized using ``isoformat()``. All\n other values will be specified as the text data type to avoid data corruption in Excel if the values happen\n to resemble a date in the current locale.\n* **Unicode-safety**: input values, including lazy objects, are converted using Django's\n `force_text `_\n function and will always be emitted as UTF-8\n* **Performance**: the code is known to work with data sets up to hundreds of thousands of rows. CSV responses\n use ``StreamingHttpResponse``, use minimal memory, and start very quickly. Excel (XLSX) responses cannot be\n streamed but `xlsxwriter `_ is one of the faster implementations\n and its memory-size optimizations are enabled.\n\nQuickstart\n----------\n\nInstall django-tabular-export::\n\n pip install django-tabular-export\n\nThen use it in a project::\n\n from tabular_export import export_to_csv_response, export_to_xlsx_response, flatten_queryset\n\n def my_view(request):\n return export_to_csv_response('test.csv', ['Column 1'], [['Data 1'], ['Data 2']])\n\n\n def my_other_view(request):\n headers = ['Title', 'Date Created']\n rows = MyModel.objects.values_list('title', 'date_created')\n return export_to_excel_response('items.xlsx', headers, rows)\n\n\n def export_using_a_generator(request):\n headers = ['A Number']\n\n def my_generator():\n for i in range(0, 100000):\n yield (i, )\n\n return export_to_excel_response('numbers.xlsx', headers, my_generator())\n\n def export_renaming_columns(request):\n qs = MyModel.objects.filter(foo=\"\u2026\").select_related(\"\u2026\")\n headers, data = flatten_queryset(qs, field_names=['title', 'related_model__title_en'],\n extra_verbose_names={'related_model__title_en': 'English Title'})\n return export_to_csv_response('custom_export.csv', headers, data)\n\n\nAdmin Integration\n~~~~~~~~~~~~~~~~~\n\nThere are two convenience `admin actions `_\nwhich make it simple to add \u201cExport to Excel\u201d and \u201cExport to CSV\u201d actions::\n\n from tabular_export.admin import export_to_csv_action, export_to_excel_action\n\n class MyModelAdmin(admin.ModelAdmin):\n actions = (export_to_excel_action, export_to_csv_action)\n\nThe default columns will be the same as you would get calling ``values_list`` on your ``ModelAdmin``'s default\nqueryset as returned by ``ModelAdmin.get_queryset()``. If you want to customize this, simply declare a new\naction on your ``ModelAdmin`` which does whatever data preparation is necessary::\n\n from tabular_export.admin import export_to_excel_action\n\n class MyModelAdmin(admin.ModelAdmin):\n actions = ('export_batch_summary_action', )\n\n def export_batch_summary_action(self, request, queryset):\n headers = ['Batch Name', 'My Computed Field']\n rows = queryset.annotate(\"\u2026\").values_list('title', 'computed_field_name')\n return export_to_excel_response('batch-summary.xlsx', headers, rows)\n export_batch_summary_action.short_description = 'Export Batch Summary'\n\n\nDebugging\n~~~~~~~~~\n\nThe ``TABULAR_RESPONSE_DEBUG = True`` setting will cause all views to return HTML tables\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/LibraryOfCongress/django-tabular-export", "keywords": "", "license": "CC0", "maintainer": "", "maintainer_email": "", "name": "django-tabular-export", "package_url": "https://pypi.org/project/django-tabular-export/", "platform": "", "project_url": "https://pypi.org/project/django-tabular-export/", "project_urls": { "Homepage": "https://github.com/LibraryOfCongress/django-tabular-export" }, "release_url": "https://pypi.org/project/django-tabular-export/1.1.0/", "requires_dist": null, "requires_python": "", "summary": "Simple spreadsheet exports from Django", "version": "1.1.0" }, "last_serial": 3295035, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "93c8ec68229a8950a9bbfff2c7c9b09f", "sha256": "6d3f4a7bc095bdae42b93c802b62b5b27749f153cd4f6a873d856d657b33c11f" }, "downloads": -1, "filename": "django_tabular_export-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "93c8ec68229a8950a9bbfff2c7c9b09f", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 10810, "upload_time": "2016-03-04T19:07:02", "url": "https://files.pythonhosted.org/packages/b0/d2/d8297d61094b5d262204d307132e4a215e2fddcd401a2066d2ac03f75bfc/django_tabular_export-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ac6b810b07994ec6b6d111a376a470ee", "sha256": "6bec1cd1359cccd04adaa0a8e634c8d8eea379bed7697179cad9362729aa9824" }, "downloads": -1, "filename": "django-tabular-export-1.0.0.tar.gz", "has_sig": false, "md5_digest": "ac6b810b07994ec6b6d111a376a470ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11408, "upload_time": "2016-03-04T19:06:54", "url": "https://files.pythonhosted.org/packages/29/33/aca4bfa68f042e8ba0c1925db108dc0ee51b397104a7551cce6ea1d812f8/django-tabular-export-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "d7f4a325407e696bd25a0312ba925d9f", "sha256": "e60112564282c08b5a14ec4968feaa902b7d958119ad73bb716c1118f0ddc25f" }, "downloads": -1, "filename": "django_tabular_export-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d7f4a325407e696bd25a0312ba925d9f", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 10947, "upload_time": "2016-03-04T20:17:13", "url": "https://files.pythonhosted.org/packages/4d/e1/125ec51a07f25a5ad3b69b1ee86518e89e06fbde3cb3f5e4e60353315379/django_tabular_export-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f29d0057a484f8d546e5bd95c125c2f4", "sha256": "f13e4bfbaedb33ece97b3aeb9bcf6bbad8824c3a1500b1022f63c2aadc566f43" }, "downloads": -1, "filename": "django-tabular-export-1.0.1.tar.gz", "has_sig": false, "md5_digest": "f29d0057a484f8d546e5bd95c125c2f4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11534, "upload_time": "2016-03-04T20:16:59", "url": "https://files.pythonhosted.org/packages/c3/3e/7f52584581bf8ea910bdfde5ba131e583a52510308836f782d2be1dce6f5/django-tabular-export-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "3da5dae6e17916995321f18d4249ebab", "sha256": "6a7934fa5bf9e5375f069b5af11a0e20e11166dfbe2983038f28b14fbd4c2298" }, "downloads": -1, "filename": "django_tabular_export-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3da5dae6e17916995321f18d4249ebab", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 11055, "upload_time": "2016-03-04T21:27:02", "url": "https://files.pythonhosted.org/packages/7c/92/3d1b06777a574b90d9eef00adfa1c46bd8d00448b8c860d3c9858a0adbff/django_tabular_export-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1ea51a7209a099eac3dd314e613648bc", "sha256": "b215db04b2fe71be03b4d247d675408e45ddc5922fdbd2e47b64ce8f1d46b383" }, "downloads": -1, "filename": "django-tabular-export-1.0.2.tar.gz", "has_sig": false, "md5_digest": "1ea51a7209a099eac3dd314e613648bc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11598, "upload_time": "2016-03-04T21:26:55", "url": "https://files.pythonhosted.org/packages/cb/56/590017cd8cc3d9e506a7b5d77008e22fe83d26ed943f78ffd5f217364953/django-tabular-export-1.0.2.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "5d99ba2b29d26260369bd2732f95c095", "sha256": "ee4c9c41ce721d7f3c7c13853c5f76ed687a52fa1f96335fc6f9d79bb3d9ca4d" }, "downloads": -1, "filename": "django_tabular_export-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5d99ba2b29d26260369bd2732f95c095", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 11120, "upload_time": "2017-10-31T18:02:46", "url": "https://files.pythonhosted.org/packages/af/8c/f9211156c3f690380e9f1b32f36ab317119d30611b8efc8fba185ca56772/django_tabular_export-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "800f0366547ce2a6884bb36ac30196ab", "sha256": "effceddfb542b046b77e7b12e7bd8ec92a5b4ff2a9562ef0aec362e276d1b6dd" }, "downloads": -1, "filename": "django-tabular-export-1.1.0.tar.gz", "has_sig": false, "md5_digest": "800f0366547ce2a6884bb36ac30196ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11528, "upload_time": "2017-10-31T18:02:42", "url": "https://files.pythonhosted.org/packages/de/82/30625049de4b1303eef2cc54559407037534e023bf4dd07f3d4b01a5e7e9/django-tabular-export-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5d99ba2b29d26260369bd2732f95c095", "sha256": "ee4c9c41ce721d7f3c7c13853c5f76ed687a52fa1f96335fc6f9d79bb3d9ca4d" }, "downloads": -1, "filename": "django_tabular_export-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5d99ba2b29d26260369bd2732f95c095", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 11120, "upload_time": "2017-10-31T18:02:46", "url": "https://files.pythonhosted.org/packages/af/8c/f9211156c3f690380e9f1b32f36ab317119d30611b8efc8fba185ca56772/django_tabular_export-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "800f0366547ce2a6884bb36ac30196ab", "sha256": "effceddfb542b046b77e7b12e7bd8ec92a5b4ff2a9562ef0aec362e276d1b6dd" }, "downloads": -1, "filename": "django-tabular-export-1.1.0.tar.gz", "has_sig": false, "md5_digest": "800f0366547ce2a6884bb36ac30196ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11528, "upload_time": "2017-10-31T18:02:42", "url": "https://files.pythonhosted.org/packages/de/82/30625049de4b1303eef2cc54559407037534e023bf4dd07f3d4b01a5e7e9/django-tabular-export-1.1.0.tar.gz" } ] }