django-commons / drf-excel

An XLSX spreadsheet renderer for Django REST Framework.
BSD 3-Clause "New" or "Revised" License
217 stars 40 forks source link

Change the data type checked by the renderer #33

Closed LeeHanYeong closed 3 years ago

LeeHanYeong commented 3 years ago

When rendering, it lets determine if the data is dict or list. (Previously, it checks if it is ReturnDict or ReturnList)

This change allows the renderer to use user-generated data.

ex)

data = {'a': 'Apple'}
XLSXRenderer().render(data=data)
LeeHanYeong commented 3 years ago

@FlipperPA Can you check this PR? For now, XLSXRenderer can only be used in the return value of the response made by the request.

In places like Celery Task or Django runcommand, you can use the basic datatypes dict or list instead of ReturnDict or ReturnList. This PR was actually created after trying to make the result of the HTTP request the same as the result of the Celery Task.

FlipperPA commented 3 years ago

Thanks for the PR! This has been released in version 0.4.1: https://pypi.org/project/drf-renderer-xlsx/0.4.1/