Add the possibility to download a file from a button handler
sronveaux opened this issue · 2 comments
Hello,
I have a case where I'd like a button to download a file by returning a FileResponse. However, the current code checks if something else than a HttpResponse is given and Redirects in that case :
django-admin-extra-buttons/src/admin_extra_buttons/handlers.py
Lines 52 to 54 in 778c94c
I made a quick and dirty patch locally to test replacing line 52 with if not isinstance(ret, (FileResponse, HttpResponse)):
and this did the trick for me.
I wondered if there was something else I wasn't aware of and if there was a reason not to give the opportunity to send back files from your excellent Django app. Otherwise, would you mind if I open a PR with this modification ?
Thanks for the excellent work,
Cheers
Sébastien
Hello,
I have exactly the same issue with StreamingHttpResponse. In my case, I need a button to download a huge zip file which needs to be streamed to the client.
Can you please add support for it as well?
Thanks!
Adrian
Same here, I need to return a FileResponse
. Happy to contribute to the PR if that's still on the table.