{ "info": { "author": "Mathieu agopian", "author_email": "mathieu.agopian@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3" ], "description": "Django-data-exports\n===================\n\n.. image:: https://secure.travis-ci.org/magopian/django-data-exports.png?branch=master\n :alt: Build Status\n :target: https://travis-ci.org/magopian/django-data-exports\n\n* Author: Mathieu Agopian and contributors_\n* Licence: BSD\n* Compatibility: Python 2.6, Python 2.7, Python 3.3, Python 3.4, Django 1.3+ (class-based-views required)\n* Requirements: django-inspect-model\n* Project URL: https://github.com/magopian/django-data-exports/\n* Documentation: http://django-data-exports.readthedocs.org/en/latest/\n\n.. _contributors: https://github.com/magopian/django-data-exports/contributors\n\nDjango-data-exports is a model data exports app for Django. It allows you to easily\ncreate exports for your models.\n\nAdding this app to your project will let you create exports for your models,\nand customize the data that will be exported by specifying which columns to include,\nand which format to use.\n\nTypical use case: display a few columns from one of your models as a HTML table to\nbe easily copy/pasted to a spreadsheet.\n\n\nInstallation\n------------\n\n::\n\n pip install django-data-exports\n\nThen add to your project's ``INSTALLED_APPS``. In ``settings.py``:\n\n::\n\n INSTALLED_APPS = (\n '...',\n # whatever you already have\n '...',\n 'data_exports',\n )\n\nInstall the models:\n\n::\n\n ./manage.py syncdb # or ./manage.py migrate if you're using south\n\nAnd finally, plug the urls to your ``ROOT_URLCONF``:\n\n::\n\n urlpatterns = patterns(\n '',\n # ... all the other urls you already have\n\n # exports\n url(r'^exports/', include('data_exports.urls', namespace='data_exports')),\n )\n\n\nUsage\n-----\n\nEither add exports through the admin, or use the included example views.\nIf there's no export format attached to an export, the ``data_exports/export_detail.html`` template will be rendered with the following context:\n\n* ``export``: the export itself\n* ``data``: a queryset of all the ``export.model``'s instance\n\n\nUsing the admin\n~~~~~~~~~~~~~~~\n\nThere's nothing specific to do here: connect to the admin, and add new exports. A few things to note:\n\n* when you create an export, it's not possible to add columns at first. The reason being that the model is needed to be able to populate the column names\n* when you add an export, clicking on the \"save\" button will have the same effect as clicking on \"save and continue editing\"\n* once an export is created, and is being edited, the columns can be added (and are displayed as inlines)\n\n\nUsing the included example views\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThere's three included example views:\n\n* ``/exports/add``: create a new export\n* ``/exports//columns``: add columns to your export\n* ``/exports/``: visualize your export\n\nThere is, at the moment, no example view for the export formats.\n\n\nExport columns\n~~~~~~~~~~~~~~\n\nColumn choices make use of django-inspect-model_ to build the list of accessible \"items\". Please check this app's documentation to know more about \"items\".\n\n.. _django-inspect-model: http://django-inspect-model.readthedocs.org/en/latest/\n\nChoices are built by ``data_exports.forms.get_choices``, and will consist of all the accessible items on the exported model, and on all its related models. The only related fields accessible are those on models that are directly related, using forward or reverse OneToOne fields and forward ForeignKey fields.\n\n*Example*:\n\n::\n\n class Foo(models.Model):\n name = CharField(max_length=50)\n bar = ForeignKey(Bar)\n\n class Bar(models.Model):\n name = CharField(max_length=50)\n\nAn export of ``Foo`` will have the following column choices:\n\n* ``name``: Foo.name\n* ``bar``: Foo.bar, which is unicode(Foo.bar)\n* ``bar.name``: Bar.name\n\nTo display the value of those columns, the included templates use ``data_exports.templatetags.getter_tags``:\n\n\nGetattribute filter\n~~~~~~~~~~~~~~~~~~~\n\n::\n\n {% load getter_tags %}\n {{ obj|getattribute:column }}\n\nThis is roughly equivalent to the ``getattr`` python builtin, but can cope with column choices:\n\n* if ``column`` doesn't have a dot, return ``getattr(obj, column)``, or ``getattr(obj, column)()`` if it's a callable\n* if ``column`` does have a dots (eg: ``bar.name``), recursively call ``getattribute()`` to get to the final attribute:\n\n::\n\n attr = getattribute(obj, 'bar.name')\n # equivalent to:\n temp = getattr(obj, 'bar')\n attr = getattr(temp, 'name')\n\n\nNice_display filter\n~~~~~~~~~~~~~~~~~~~\n\n::\n\n {% load getter_tags %}\n {{ obj|getattribute:column|nice_display }}\n\nFor now, all this does is return a comma-separated list of related instances for a many-to-many field.\n\nIf the ``item`` field has an ``all`` method:\n\n::\n\n return ', '.join(map(unicode, item.all()))\n\n\nAdvanced usage\n--------------\n\nExport formats\n~~~~~~~~~~~~~~\n\nExports can export to a given format:\n\n::\n\n class Format(models.Model):\n name = models.CharField(max_length=50)\n file_ext = models.CharField( max_length=10, blank=True)\n mime = models.CharField(max_length=50)\n template = models.CharField(max_length=255)\n\nThe ``mime`` field is the ``Content-Type`` needed for the response. ``file_ext`` will be used to compute the export's filename, provided via ``Content-Disposition`` header.\n\n*Example*: let's take a naive export to csv:\n\n* mime: text/csv\n* file_ext: csv\n* name: Naive CSV format\n* template: ``data_exports/export_detail_csv.html`` (included as an example)\n\nIf an export uses this format, visiting the export's view page ``/exports/`` will offer a file download, named ``.csv``.\n\nFiltering exports\n~~~~~~~~~~~~~~~~~\n\nTo restrict entries access, you can use a class method or a static method ``export_queryset`` which will get the request object\nand returns the queryset of items to display.\n\n::\n\n from django.contrib.auth.models import User\n from django.db import models\n \n class Client(models.Model):\n name = models.CharField(max_length=63)\n users = models.ManyToManyField(User)\n\n\n class ClientData(models.Model):\n client = models.ForeignKey('Client')\n address = models.CharField(max_length=255)\n money_hidden_in_the_garden = models.IntegerField()\n \n @classmethod\n def export_queryset(cls, request):\n qs = cls.objects.all()\n if not request.user.is_superuser:\n qs = qs.filter(client__in=request.user.client_set.all())\n return qs\n\n\nUsing your own views\n~~~~~~~~~~~~~~~~~~~~\n\nTo use your own views, you need to use the same url names as in ``data_exports/urls.py``, and make sure they use the ``data_exports`` namespace, as ``django.core.urlresolvers.reverse`` is used internally to compute the needed urls.\n\nYou can check the included example views in ``data_exports/views.py``, and of course reuse the forms provided in ``data_exports/forms.py``.\n\n\nDecorating the included views\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nSay you need to decorate the export view with the ``staff_member_required``\ndecorator:\n\n::\n\n url(r'^export/(?P[^/]+)/?$',\n staff_member_required(export_view),\n name='export_view'),\n\nYou still need to include this new url using a namespace, or the calls to\n``reverse`` in the views won't work. This is a way to do it (taken from the\n`Django documentation`_:\n\n::\n\n from django.conf.urls import include, patterns, url\n\n data_exports_patterns = patterns('',\n url(r'^export/(?P[^/]+)/?$',\n staff_member_required(export_view),\n name='export_view'),\n )\n\n url(r'^exports', include(data_exports_patterns, namespace='data_exports')),\n\n.. _Django documentation:\n https://docs.djangoproject.com/en/dev/topics/http/urls/#url-namespaces-and-included-urlconfs\n\n\nUsing your own templates\n~~~~~~~~~~~~~~~~~~~~~~~~\n\n``Django-data-exports`` makes use of Django's template overloading mechanism. This means that if you provide a ``data_exports/export_detail.html`` template which has precedence over the one bundled with the app, it'll be used.\n\n*Example*: say you have a ``templates/`` folder in your project, and the appropriate ``TEMPLATE_DIRS`` setting. Place your own template in ``project/templates/data_exports/export_detail.html`` to have it used instead of the template bundled with the app in ``data_exports/templates/data_exports/export_detail.html``.\n\nThere's three included templates:\n\n* ``data_exports/base.html``: extended by the two other templates\n* ``data_exports/export_detail.html``: used by default for exports that don't specify a format\n* ``data_exports/export_detail_csv.html``: used by the \"naive csv format\" detailed in `Export formats`_.\n\n\nHacking\n-------\n\nSetup your environment:\n\n::\n\n git clone https://github.com/magopian/django-data-exports.git\n cd django-data-export\n\nHack and run the tests using `Tox `_ to test\non all the supported python and Django versions:\n\n::\n\n make test\n\nTo build the docs:\n\n::\n\n make docs", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/magopian/django-data-exports", "keywords": null, "license": "BSD license, see LICENSE file", "maintainer": null, "maintainer_email": null, "name": "django-data-exports", "package_url": "https://pypi.org/project/django-data-exports/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-data-exports/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/magopian/django-data-exports" }, "release_url": "https://pypi.org/project/django-data-exports/0.7/", "requires_dist": null, "requires_python": null, "summary": "Model data exports for Django", "version": "0.7" }, "last_serial": 1225437, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "e7127e0ee47e888083ebfcd5c259f210", "sha256": "ba12c81b47723a6a451fa68a25c68b54ffdd1cd844ee3a7a58bba49c193f854d" }, "downloads": -1, "filename": "django-data-exports-0.1.tar.gz", "has_sig": false, "md5_digest": "e7127e0ee47e888083ebfcd5c259f210", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7757, "upload_time": "2011-06-05T19:12:31", "url": "https://files.pythonhosted.org/packages/33/c6/703700cc9a51e7c6e32eb22d2a221caae643d89b4259ed7ab6a0383138e5/django-data-exports-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "4123b583b905eea33ca32edb18de22b9", "sha256": "9618f22778b1fa3cff10011733f2529e6022eb84ec7ce6c340556acebf4ca00b" }, "downloads": -1, "filename": "django-data-exports-0.2.tar.gz", "has_sig": false, "md5_digest": "4123b583b905eea33ca32edb18de22b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9607, "upload_time": "2011-06-08T14:39:18", "url": "https://files.pythonhosted.org/packages/42/9b/0961a11bd8dd0d3369bd7a7216476b7eedf24120a298e37aeed3c9a0dc0e/django-data-exports-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "b456dc81248850ffa858f61d8530a15b", "sha256": "914d12bfb37e27c59adb834fc099753e30da6b898fa9a135143c535ec59839fc" }, "downloads": -1, "filename": "django-data-exports-0.3.tar.gz", "has_sig": false, "md5_digest": "b456dc81248850ffa858f61d8530a15b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10974, "upload_time": "2012-11-08T18:53:20", "url": "https://files.pythonhosted.org/packages/77/3d/b3f5024c8d91bbca547499d42bf9e3d0d81736c01b370c11f75a4064954f/django-data-exports-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "f56a0e33d53352b520d6be5346d03f21", "sha256": "7ede8f0d4df72a44d38e9988791e3061c9dcd5cb7e863c44629972fa79198a22" }, "downloads": -1, "filename": "django-data-exports-0.4.tar.gz", "has_sig": false, "md5_digest": "f56a0e33d53352b520d6be5346d03f21", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13262, "upload_time": "2013-07-28T06:29:53", "url": "https://files.pythonhosted.org/packages/cf/66/745174fd1d8330b979b3efa8bcc0b5c77ac2a415bebf33cded5ddeb35fa1/django-data-exports-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "b54e8fd677b21340496a1afbd1b31569", "sha256": "5893120c76e5903d1682f5fe025a86a793e0209c5d780d9a4ca2918ba7cd909b" }, "downloads": -1, "filename": "django-data-exports-0.5.tar.gz", "has_sig": false, "md5_digest": "b54e8fd677b21340496a1afbd1b31569", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14040, "upload_time": "2013-10-14T19:06:29", "url": "https://files.pythonhosted.org/packages/cc/e1/a8b506098e99db0963c07b52de7db1ca3f06415ec17d87e17de1f7a0d090/django-data-exports-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "f81f107663780552fef2b40051e43581", "sha256": "e1d013e2daa785341f9a2df96bc20cf10ff0d670e2e74c7737ed980d83108b13" }, "downloads": -1, "filename": "django_data_exports-0.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f81f107663780552fef2b40051e43581", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 25184, "upload_time": "2013-11-14T08:14:34", "url": "https://files.pythonhosted.org/packages/65/9a/f54585f42e2c661935f298176795659ad9342b1a9785e7eaff8870261359/django_data_exports-0.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c3b68edd981f808b02cbe700cb313104", "sha256": "7c583154986c51cab4f6345e66d9854438ff72c72dbf96640da710548f66f67d" }, "downloads": -1, "filename": "django-data-exports-0.6.tar.gz", "has_sig": false, "md5_digest": "c3b68edd981f808b02cbe700cb313104", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14140, "upload_time": "2013-11-12T17:46:11", "url": "https://files.pythonhosted.org/packages/46/2c/60ea490b3ea98ea791c357214e171789fac944f2d400c638ca0c51cee690/django-data-exports-0.6.tar.gz" } ], "0.7": [ { "comment_text": "", "digests": { "md5": "3ccc462776a788a8fd4c3580865f2a42", "sha256": "325970c84ff3c54e1e2ef095ab2029635c155810efa6f7a13b578bbd22503d4b" }, "downloads": -1, "filename": "django_data_exports-0.7-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3ccc462776a788a8fd4c3580865f2a42", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 27449, "upload_time": "2014-09-15T20:13:34", "url": "https://files.pythonhosted.org/packages/51/85/99d8fb8c4f43c0a384c4f488f98d1d8da1a67fddc51871d1b899b778b83e/django_data_exports-0.7-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6df107dba1163efb0f8fe7c20ce77863", "sha256": "ffdbac11bffe491b749818b3c854a7abd98bbbbfdbca06e5d748f975e3cbf719" }, "downloads": -1, "filename": "django-data-exports-0.7.tar.gz", "has_sig": false, "md5_digest": "6df107dba1163efb0f8fe7c20ce77863", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15371, "upload_time": "2014-09-15T20:13:29", "url": "https://files.pythonhosted.org/packages/0a/b7/e43db3ce9163d21a257791f5852cb0c8c70b494bd0f8ba1a93bb04879846/django-data-exports-0.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3ccc462776a788a8fd4c3580865f2a42", "sha256": "325970c84ff3c54e1e2ef095ab2029635c155810efa6f7a13b578bbd22503d4b" }, "downloads": -1, "filename": "django_data_exports-0.7-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3ccc462776a788a8fd4c3580865f2a42", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 27449, "upload_time": "2014-09-15T20:13:34", "url": "https://files.pythonhosted.org/packages/51/85/99d8fb8c4f43c0a384c4f488f98d1d8da1a67fddc51871d1b899b778b83e/django_data_exports-0.7-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6df107dba1163efb0f8fe7c20ce77863", "sha256": "ffdbac11bffe491b749818b3c854a7abd98bbbbfdbca06e5d748f975e3cbf719" }, "downloads": -1, "filename": "django-data-exports-0.7.tar.gz", "has_sig": false, "md5_digest": "6df107dba1163efb0f8fe7c20ce77863", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15371, "upload_time": "2014-09-15T20:13:29", "url": "https://files.pythonhosted.org/packages/0a/b7/e43db3ce9163d21a257791f5852cb0c8c70b494bd0f8ba1a93bb04879846/django-data-exports-0.7.tar.gz" } ] }