mjumbewu / django-rest-framework-csv

CSV Tools for Django REST Framework
BSD 2-Clause "Simplified" License
364 stars 89 forks source link

Include a paginated renderer as part of the app #17

Open lylepratt opened 10 years ago

lylepratt commented 10 years ago

Thanks for this great add-on!

For some reason when I download my data in CSV format, it is returned in 2 giant rows, with all items combined on the rows.

Screenshot: https://www.dropbox.com/s/8aecjorj658om2s/Screenshot%202014-05-22%2009.47.49.png

Why is this happening and how do I get it to correctly export the rows?

Thanks, Lyle

mjumbewu commented 10 years ago

Hey @lylepratt,

Sorry for the delay here. This is happening because the renderer doesn't automatically know how to deal with pagination. There is an example of what to do in the README though: https://github.com/mjumbewu/django-rest-framework-csv/blob/master/README.rst#pagination

I'm pretty sure someone ran in to this before. This renderer should probably be a proper part of the app.

EDIT: I've updated the title of the ticket.

peritus commented 9 years ago

I think it would be a good idea to add the PaginatedCSVRenderer in https://github.com/mjumbewu/django-rest-framework-csv/blob/master/rest_framework_csv/renderers.py and ship it as part of django-rest-framework-csv — so users don't have top copy&paste it from the README to their own application but can just do

from rest_framework_csv.renderers import PaginatedCSVRenderer

should I create a separate issue for that ?

Guest007 commented 8 years ago

If I have globally setted 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', for all my JSON rendered endpoints, I can't see anything in my single CSV endpoint. How I can switch off pagination for exactly CSV endpoint?