Django REST Pandas 1.1.0 includes a new filename option (#31), confirmed support for Django 2, and a couple of minor fixes.
New Functionality
Added a get_pandas_filename()
view method, for cases where you have users downloading files through the API (#31). For example:
class TimeSeriesView(PandasView):
# If a filename is returned, rest_pandas will include the following header:
# 'Content-Disposition: attachment; filename="Data Export.xlsx"'
def get_pandas_filename(self, request, format):
if format in ('xls', 'xlsx'):
# Use custom filename and Content-Disposition header
return "Data Export" # Extension will be appended automatically
else:
# Default filename from URL (no Content-Disposition header)
return None
Bug Fixes
- Don't crash if
renderer_context
is missing (#34) PandasBoxplotSerializer
: handle non-numeric columns and duplicate rows (abeb576)