Last active
February 4, 2020 14:49
-
-
Save samarism/0aff412f09c7f37d0524ac3da9abb53a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class XLSRenderer(renderers.BaseRenderer): | |
# https://blogs.msdn.microsoft.com/vsofficedeveloper/2008/05/08/office-2007-file-format-mime-types-for-http-content-streaming-2/ | |
media_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' | |
format = 'xlsx' | |
charset = None | |
render_style = 'binary' | |
def render(self, data, accepted_media_type=None, renderer_context=None): | |
logger.info(f'XLSRenderer svn data: {data["svns"]}') | |
expose_transcripts = data['organization'].features.expose_transcripts | |
wb = SVNWorkbookGenerator( | |
data['svns'], | |
expose_transcripts=expose_transcripts | |
).generate() | |
# excel files are some kind of zipped xml data | |
logger.info("saving workbook") | |
return wb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment