{ "info": { "author": "Steve Lamb", "author_email": "slamb@azavea.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Plugins", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License (GPL)", "Programming Language :: Python" ], "description": ".. image:: https://travis-ci.org/azavea/django-queryset-csv.png\n :target: https://travis-ci.org/azavea/django-queryset-csv/\n\n.. image:: https://coveralls.io/repos/azavea/django-queryset-csv/badge.svg?branch=master&service=github\n :target: https://coveralls.io/r/azavea/django-queryset-csv/\n\n.. image:: https://img.shields.io/pypi/v/django-queryset-csv.svg\n :target: http://pypi.python.org/pypi/django-queryset-csv/\n\na CSV exporter for django querysets.\n\nThis tool was created out of repeatedly needing to do the following in django:\n\n1. write CSV data that is based on simple querysets.\n2. automatically encode unicode characters to utf-8\n3. create a shortcut to render a queryset to a CSV HTTP response\n4. add a time/datestamping mechanism to CSV filenames\n\nFor more detailed documentation, please read `this blog post. `_\n\nInstallation\n------------\n\nRun::\n\n pip install django-queryset-csv\n\nSupports Python 2.7 and 3.5, Django >= 1.8.\n\nUsage\n-----\nPerform all filtering and field authorization in your view using ``.filter()`` and ``.values()``.\nThen, use ``render_to_csv_response`` to turn a queryset into a response with a CSV attachment.\nPass it a ``QuerySet`` or ``ValuesQuerySet`` instance::\n\n from djqscsv import render_to_csv_response\n\n def csv_view(request):\n qs = Foo.objects.filter(bar=True).values('id', 'bar')\n return render_to_csv_response(qs)\n\nIf you need to write the CSV to a file you can use ``write_csv`` instead::\n\n from djqscsv import write_csv\n\n qs = Foo.objects.filter(bar=True).values('id', 'bar')\n with open('foo.csv', 'wb') as csv_file:\n write_csv(qs, csv_file)\n\nForeign keys\n------------\n\nForeign keys are supported natively using ``ValuesQuerySet`` in Django. Simply use the ``__`` technique as you would in the Django ORM when you pass args to the ``.values()`` method.\n\nmodels.py::\n\n from django.db import models\n\n class Food(models.Model):\n name = models.CharField(max_length=20)\n\n class Person(models.Model):\n name = models.CharField(max_length=20)\n favorite_food = models.ForeignKey(Food)\n\nviews.py::\n\n from djqscsv import render_to_csv_response\n\n def csv_view(request):\n people = Person.objects.values('name', 'favorite_food__name')\n return render_to_csv_response(people)\n\nKeyword arguments\n-----------------\n\nThis module exports two functions that write CSVs, ``render_to_csv_response`` and ``write_csv``. Both of these functions require their own positional arguments as documented above. In addition, they both take the following optional keyword arguments:\n\n- ``field_header_map`` - (default: ``None``) A dictionary mapping names of model fields to column header names. If specified, the csv writer will use these column headers. Otherwise, it will use defer to other parameters for rendering column names.\n- ``field_serializer_map`` - (default: ``{}``) A dictionary mapping names of model fields to functions that serialize them to text. For example, ``{'created': (lambda x: x.strftime('%Y/%m/%d')) }`` will serialize a datetime field called ``created``.\n- ``use_verbose_names`` - (default: ``True``) A boolean determining whether to use the django field's ``verbose_name``, or to use it's regular field name as a column header. Note that if a given field is found in the ``field_header_map``, this value will take precendence.\n- ``field_order`` - (default: ``None``) A list of fields to determine the sort order. This list need not be complete: any fields not specified will follow those in the list with the order they would have otherwise used.\n\nIn addition to the above arguments, ``render_to_csv_response`` takes the following optional keyword arguments:\n\n- ``filename`` - (default: ``None``) A string used to set a filename in the ``Content-Disposition`` header as part of the returned ``HttpResponse``. If this is not passed, a filename will be automatically generated based on the table name of the QuerySet.\n- ``append_datestamp`` - (default: ``False``) A boolean determining whether to append a timestamp as part of the filename set in the ``Content-Disposition`` header.\n- ``streaming`` - (default: ``True``) A boolean determining whether to use ``StreamingHttpResponse`` instead of the normal ``HttpResponse``.\n\nThe remaining keyword arguments are *passed through* to the csv writer. For example, you can export a CSV with a different delimiter.\n\nviews.py::\n\n from djqscsv import render_to_csv_response\n\n def csv_view(request):\n people = Person.objects.values('name', 'favorite_food__name')\n return render_to_csv_response(people, delimiter='|')\n\nFor more details on possible arguments, see the documentation on `DictWriter `_.\n\n\nDevelopment and contributions\n-----------------------------\n\nPlease read the included ``CONTRIBUTING.rst`` file.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/azavea/django-queryset-csv", "keywords": "django queryset csv", "license": "", "maintainer": "Michael Maurizi", "maintainer_email": "mmaurizi@azavea.com", "name": "django-queryset-csv", "package_url": "https://pypi.org/project/django-queryset-csv/", "platform": "", "project_url": "https://pypi.org/project/django-queryset-csv/", "project_urls": { "Homepage": "http://github.com/azavea/django-queryset-csv" }, "release_url": "https://pypi.org/project/django-queryset-csv/1.0.2/", "requires_dist": null, "requires_python": "", "summary": "A simple python module for writing querysets to csv", "version": "1.0.2" }, "last_serial": 5208620, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "7fddfe236cd9dd653d1664eb8dca9646", "sha256": "8a78183f1ee50885230c50fb9cf62415ca95c8474f43c9daeed6d4089cd8f27c" }, "downloads": -1, "filename": "django-queryset-csv-0.1.1.tar.gz", "has_sig": false, "md5_digest": "7fddfe236cd9dd653d1664eb8dca9646", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2444, "upload_time": "2013-11-02T01:01:23", "url": "https://files.pythonhosted.org/packages/4d/09/d3513f742fe45c291e1f4b0f3181d42b1c35b5b1472c678045ee64826036/django-queryset-csv-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "d11016164537e69def28e315f822ebd2", "sha256": "e5181dd179149c99279b4ea40047e8dc6c067c72364536a5b37c7a57672c7bac" }, "downloads": -1, "filename": "django-queryset-csv-0.2.0.tar.gz", "has_sig": false, "md5_digest": "d11016164537e69def28e315f822ebd2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17285, "upload_time": "2014-01-27T16:23:57", "url": "https://files.pythonhosted.org/packages/5b/0b/be1a4275700af59dd55b6dc39c718fdb07a4d1fb67842cc267bd0b4e10e4/django-queryset-csv-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "1be2f93ca2916a4e72ec2f8acc14e195", "sha256": "6103cc79d24b715314e59ad3665444f24e19c9e0676c873e7161c954f1a6ebe5" }, "downloads": -1, "filename": "django-queryset-csv-0.2.1.tar.gz", "has_sig": false, "md5_digest": "1be2f93ca2916a4e72ec2f8acc14e195", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17349, "upload_time": "2014-02-03T23:44:37", "url": "https://files.pythonhosted.org/packages/60/59/f7de32babc920adbdc42001136edb64c006b4000601f913b6c9829c9d80c/django-queryset-csv-0.2.1.tar.gz" } ], "0.2.10": [ { "comment_text": "", "digests": { "md5": "a2a3e9c0ce290d02ade17234400bb88b", "sha256": "fa4aef6025402b1d79913928dc941dcfcadad004fb91ebe1e1ee881a6237733c" }, "downloads": -1, "filename": "django-queryset-csv-0.2.10.tar.gz", "has_sig": false, "md5_digest": "a2a3e9c0ce290d02ade17234400bb88b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19110, "upload_time": "2014-10-08T15:48:04", "url": "https://files.pythonhosted.org/packages/4a/22/27958d57f51758de332f1f2e7f3b5ec898dbc2bb4eeb80df6aea52208977/django-queryset-csv-0.2.10.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "276ccffa4efd190094fe020c6a33024a", "sha256": "a82476074350a26779488c5fd16429576f0e5beea21944b74c3e43ea8ef43b5b" }, "downloads": -1, "filename": "django-queryset-csv-0.2.2.tar.gz", "has_sig": false, "md5_digest": "276ccffa4efd190094fe020c6a33024a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17364, "upload_time": "2014-02-04T00:27:22", "url": "https://files.pythonhosted.org/packages/b1/a2/d3ae91a07f761c3c58a808324d24bc21828353a7db9172da2dc2545812fc/django-queryset-csv-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "62ffcf91509e4314a4a1771e71f912b4", "sha256": "4b7098688a41f6bb2c120765c27f6346635c088cc2b285ec8925b2eba5924902" }, "downloads": -1, "filename": "django-queryset-csv-0.2.3.tar.gz", "has_sig": false, "md5_digest": "62ffcf91509e4314a4a1771e71f912b4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17431, "upload_time": "2014-02-04T18:40:41", "url": "https://files.pythonhosted.org/packages/07/f2/be4a4638737d58130b1173928cfad39349d88a4815c725c203d818a29f47/django-queryset-csv-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "7da429ae3f0f4271846ad415b2c6da39", "sha256": "ce41d5214c64de4764cdf74708f9e0d6c26a1b6e2d3068574d71ce2846a732ce" }, "downloads": -1, "filename": "django-queryset-csv-0.2.4.tar.gz", "has_sig": false, "md5_digest": "7da429ae3f0f4271846ad415b2c6da39", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17434, "upload_time": "2014-02-04T22:36:51", "url": "https://files.pythonhosted.org/packages/ed/e2/d2a169f91e03f8d2fdc3efd9fcbcebc295177a3ad671e466958bbeeabfb3/django-queryset-csv-0.2.4.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "3695c66f22adf7b1bd06c928e8ece9a5", "sha256": "1f5b461b56eb920054f9fa5041db713bc8303d4de26b5e412bb52b193d2c728c" }, "downloads": -1, "filename": "django-queryset-csv-0.2.5.tar.gz", "has_sig": false, "md5_digest": "3695c66f22adf7b1bd06c928e8ece9a5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17159, "upload_time": "2014-02-17T01:38:54", "url": "https://files.pythonhosted.org/packages/96/05/670c9ad2a6e71c7e4f89242d84b294f28547782b2cd374e8a8651c8efe20/django-queryset-csv-0.2.5.tar.gz" } ], "0.2.7": [ { "comment_text": "", "digests": { "md5": "6307cd4c76038579105fe61ddb9945dc", "sha256": "bc89052e4fd2c4f91fb8f6f73b49db3cff872ee4b2f5b5818d3ca2b6492c6c89" }, "downloads": -1, "filename": "django-queryset-csv-0.2.7.tar.gz", "has_sig": false, "md5_digest": "6307cd4c76038579105fe61ddb9945dc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17315, "upload_time": "2014-02-19T15:33:14", "url": "https://files.pythonhosted.org/packages/c2/f4/3da701f66785382ef39d859ab7bee8e2b8005039cd5ae88542d849be39bd/django-queryset-csv-0.2.7.tar.gz" } ], "0.2.8": [ { "comment_text": "", "digests": { "md5": "8f20274fbfc79a424db4fcd4258c9681", "sha256": "486521b66bd90a43d1d137021a9e6023aabd5f97c753e3aaccab148fb343efd8" }, "downloads": -1, "filename": "django-queryset-csv-0.2.8.tar.gz", "has_sig": false, "md5_digest": "8f20274fbfc79a424db4fcd4258c9681", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17806, "upload_time": "2014-03-25T14:37:34", "url": "https://files.pythonhosted.org/packages/e5/6d/fdbb203d90356a537e63e6d1d26fa76aee017695bfba8dc7ad63abb8d6a4/django-queryset-csv-0.2.8.tar.gz" } ], "0.2.9": [ { "comment_text": "", "digests": { "md5": "b3740a6e068e5b5b7cc1ca7e1c0a05f8", "sha256": "8cd5f9dbd93efcafa00df3ee9eb5ab1e255ca199053a5624cf0619abe3206d36" }, "downloads": -1, "filename": "django-queryset-csv-0.2.9.tar.gz", "has_sig": false, "md5_digest": "b3740a6e068e5b5b7cc1ca7e1c0a05f8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17887, "upload_time": "2014-07-15T21:28:06", "url": "https://files.pythonhosted.org/packages/fc/45/5e6e7e5abbd671e96f3e2d8cae19465854b837a2d17c0ac675f8a32d89e2/django-queryset-csv-0.2.9.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "4e2b794a25e4ac4c2b4eaf5170b2319f", "sha256": "311565e41f28b7376dc30e8e1dc074c45024e736a386fb490756f5e973dc6417" }, "downloads": -1, "filename": "django-queryset-csv-0.3.0.tar.gz", "has_sig": false, "md5_digest": "4e2b794a25e4ac4c2b4eaf5170b2319f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19486, "upload_time": "2014-12-29T16:48:33", "url": "https://files.pythonhosted.org/packages/07/b0/087ae00a18d068fda777b6456c1386f4fd27d9863dcf60a5460129e70aec/django-queryset-csv-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "15c49df4eac0af9fa012284c5bbe9816", "sha256": "25923f4e49347fa49a0de89e7c2e9ada2d23f1d0e660d4f717c393956eac4c3c" }, "downloads": -1, "filename": "django-queryset-csv-0.3.1.tar.gz", "has_sig": false, "md5_digest": "15c49df4eac0af9fa012284c5bbe9816", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19550, "upload_time": "2015-07-27T18:27:15", "url": "https://files.pythonhosted.org/packages/bf/90/4b54e22fd716e9fbe91aab3e2e5f2e0b1aa067c08e8d4aa760ba738c7068/django-queryset-csv-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "5c110f86f51421aa21416f5d3746f6c1", "sha256": "fdf3946f4283e11ef4a25921d5d769e186eb80432d42c9e4b9a90e58bc6999e6" }, "downloads": -1, "filename": "django-queryset-csv-0.3.2.tar.gz", "has_sig": false, "md5_digest": "5c110f86f51421aa21416f5d3746f6c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19565, "upload_time": "2015-11-10T20:37:40", "url": "https://files.pythonhosted.org/packages/63/c6/4a0bfce1958dc5c56bb578fdca9de6f628f5df9366a8d320b11d35899e95/django-queryset-csv-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "881805161f910ffd9c061101e6a661a0", "sha256": "ae1f2dcedcad3c47d6019014a71c9044bc14ef94df3ff8ce2b984327575bd0e4" }, "downloads": -1, "filename": "django-queryset-csv-0.3.3.tar.gz", "has_sig": false, "md5_digest": "881805161f910ffd9c061101e6a661a0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19855, "upload_time": "2016-01-22T20:26:15", "url": "https://files.pythonhosted.org/packages/c3/08/5a31f7556303c7fc14ff6a02931d9f3dcc549cac8784616c914ec31da677/django-queryset-csv-0.3.3.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "3e9b386f047c52a59091bd7c1802527e", "sha256": "8f700ae5e28f2a3571f8101dd66f99a2a8cd52b3d281593c7389bbb68605065f" }, "downloads": -1, "filename": "django_queryset_csv-1.0.0-py2.7.egg", "has_sig": false, "md5_digest": "3e9b386f047c52a59091bd7c1802527e", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 10973, "upload_time": "2016-11-02T16:41:26", "url": "https://files.pythonhosted.org/packages/5e/5b/82bdf52d68cbb9f07ad34e4177b36a4c5baf9a3812efc9e82308f291f66f/django_queryset_csv-1.0.0-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "c91d479116beec7e91bb60a5cf5afd18", "sha256": "9ba890536fb48ba9bf2a2f75d1205ac01d58c127da19e5a8e8dc096c207d4818" }, "downloads": -1, "filename": "django-queryset-csv-1.0.0.tar.gz", "has_sig": false, "md5_digest": "c91d479116beec7e91bb60a5cf5afd18", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20211, "upload_time": "2016-11-02T16:41:24", "url": "https://files.pythonhosted.org/packages/06/ee/77085a6ca641dc5ada7dcc492d981dad27e9f8e9228f568bbf0f7e55662c/django-queryset-csv-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "08cba3681219d4ac76d71aa71796e89d", "sha256": "cc65181bf35d97116cb8e4b207519f9d3f605561f2b0f414da2e4253604a374a" }, "downloads": -1, "filename": "django-queryset-csv-1.0.1.tar.gz", "has_sig": false, "md5_digest": "08cba3681219d4ac76d71aa71796e89d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20223, "upload_time": "2018-04-20T17:54:23", "url": "https://files.pythonhosted.org/packages/ab/62/04075a7cd382b34be105b6dc4b38e34e001a711921be91ba4c1ac529fd36/django-queryset-csv-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "4469a9f02710d323d42d559f2899ddc3", "sha256": "714f3639831441c00e639d1beb929c9444da22e77634668c552aad50d2957a4e" }, "downloads": -1, "filename": "django-queryset-csv-1.0.2.tar.gz", "has_sig": false, "md5_digest": "4469a9f02710d323d42d559f2899ddc3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20016, "upload_time": "2019-04-30T15:04:50", "url": "https://files.pythonhosted.org/packages/01/5f/4db235cbdfd3b5ee4ae255769b55882b36b0c2ce2988d3e1cc24d9c57534/django-queryset-csv-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4469a9f02710d323d42d559f2899ddc3", "sha256": "714f3639831441c00e639d1beb929c9444da22e77634668c552aad50d2957a4e" }, "downloads": -1, "filename": "django-queryset-csv-1.0.2.tar.gz", "has_sig": false, "md5_digest": "4469a9f02710d323d42d559f2899ddc3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20016, "upload_time": "2019-04-30T15:04:50", "url": "https://files.pythonhosted.org/packages/01/5f/4db235cbdfd3b5ee4ae255769b55882b36b0c2ce2988d3e1cc24d9c57534/django-queryset-csv-1.0.2.tar.gz" } ] }