When you use given renderer on empty sequence, it raises an exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 217, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 215, in _get_response
response = response.render()
File "/usr/local/lib/python2.7/site-packages/django/template/response.py", line 107, in render
self.content = self.rendered_content
File "/usr/local/lib/python2.7/site-packages/rest_framework/response.py", line 72, in rendered_content
ret = renderer.render(self.data, accepted_media_type, context)
File "/usr/local/lib/python2.7/site-packages/drf_renderer_xlsx/renderers.py", line 120, in render
for column_name in results[0].keys():
IndexError: list index out of range
Please add proper handling there. It should work fine with empty results (then it should show only header).
When you use given renderer on empty sequence, it raises an exception:
Please add proper handling there. It should work fine with empty results (then it should show only header).