django-rest-pandas icon indicating copy to clipboard operation
django-rest-pandas copied to clipboard

Possible to Access ExcelRenderer from PandasSimpleView?

Open geoffrey-eisenbarth opened this issue 4 years ago • 0 comments

Apologies, this is probably not the best place to ask this question, but it might lend itself to some useful enhancements to others and I wasn't sure if there was a better forum for asking questions.

I am extending PandasExcelRenderer so that I can 1) use a permanent file (with a filename based on URL parameters passed to renderer_context) stored on my server instead of a temp file and 2) set the sheetname of the file based on the filename of the permanent file. The filename and sheetname are defined in get_pandas_kwargs based on renderer_context and sheet_name is specified in the return value of get_pandas_kwargs.

Is there any way to access this information in PandasSimpleView? Currently I am duplicating the code form get_pandas_kwargs (to determine filename) in PandasSimpleView.get_pandas_filename(), but was hoping for something cleaner and more DRY.

Any guidance or suggestions would be greatly appreciated. Again, apologies if this is the wrong place to post this question, a redirect to a better forum would be appreciated as well if applicable.

geoffrey-eisenbarth avatar Jun 24 '20 17:06 geoffrey-eisenbarth