I need to return generated file download as a Django REST Framework response. I tried the following:
def retrieve(self, request, *args, **kwargs): template =
This may work for you:
file_path = file_url FilePointer = open(file_path,"r") response = HttpResponse(FilePointer,content_type='application/msword') response['Content-Disposition'] = 'attachment; filename=NameOfFile' return response.
For FrontEnd code refer this