Package: django-export-download
# django-export-download`django-export-download` allows you to use your ListView to download it in different file formatslike CSV or XLS by just adding the Mixin.It provides a MultipleObject/ListView Mixin for Django. By passing the `download` GET parameter you candownload the file.You can use this view to download the object list in different file fomats like CSV, XLS and more.You just have to provide a `Resource` class from `django-import-export`.I addition it work very good in you `django-tables2`/`django-filter` environment.Finally the package ships with a templatetag to include some download buttons in your ListView template.# RequirementsThe package is tested with following versions, but it also shouldwork with newer or older versions* Django >= 1.11* django-import-export >= 1.0.0* Python >= 3.5# Quickstart```pythonviews.py:from import_export import resourcesfrom export_download.views import ResourceDownloadMixinfrom django.views.generic import ListViewclass MovieBudgetResource(resources.ModelResource):class Meta:model = Moviefields = ['title', 'budget']class MovieListView(ResourceDownloadMixin, ListView):model = Movieresource_class = MovieBudgeturls.py:urlpatterns = [path('movie/', MovieListView.as_view(), name='movie-list'),]```By visiting http://localhost:8000/movie/?download you can download a CSV (which is the default) file with the moviesand their budget.```http://localhost:8000/movie/?download&resource_format=xls will download a Excel file.```# Dokumentation## Class OptionsHere is a more complex example that includes several `Resources` and different file formats.It also is a example how to use `django-export-download` with `django-filter` and `django-tables2`.```pythonimport django_tables2 as tablefrom import_export import resourcesfrom export_download.views import ResourceDownloadMixinfrom django.views.generic import ListViewclass MovieResource(resources.ModelResource):class Meta:model = Moviefields = ['title', 'budget', 'tatus', 'votes', 'release_date']class OnlyMovieResource(resources.ModelResource):class Meta:model = Moviefields = ['title']class MovieBudgetResource(resources.ModelResource):class Meta:model = Moviefields = ['title', 'budget']class MovieListView(ResourceDownloadMixin, ListView, table.SingleTableMixin):model = Movietable_class = MovieTablefilter_class = MovieFilterresource_class = [MovieResource,OnlyMovieResource,MovieBudgetResource]resource_formats = ['csv', 'tsv', 'xls']```This implementation support 3 download formats with 3 different `Resources`. Following URLs are givingyou the files:```http://localhost:8000/movie/?download&resource_class=0&resource_format=xlshttp://localhost:8000/movie/?download&resource_class=0&resource_format=csvhttp://localhost:8000/movie/?download&resource_class=0&resource_format=tsvhttp://localhost:8000/movie/?download&resource_class=1&resource_format=xlshttp://localhost:8000/movie/?download&resource_class=1&resource_format=csvhttp://localhost:8000/movie/?download&resource_class=1&resource_format=tsvhttp://localhost:8000/movie/?download&resource_class=2&resource_format=xlshttp://localhost:8000/movie/?download&resource_class=2&resource_format=csvhttp://localhost:8000/movie/?download&resource_class=2&resource_format=tsv```Note that `resource_class` defines the position of the `Resource` implementation in the list of `resource_class`In this example there also is a `filter_class`. `django-export-download` automatically applies the filterto the queryset. It is not required, but works really well. Have a look at https://github.com/carltongibson/django-filterfor more information.## Templatetags`django-export-download` ships with a templatetag to render all links above.You now can use the templatetag in you ListView```html{% load export_download %}{% resource_download_menu %}```# ContributeFork and send a PR