How to redirect to another url after downloading a file attachment in django

Viewed 121

The file which I have generated in django view, after downloading this attachment I need to redirect to other url.

Please someone suggest me how to achieve this or any other method to download file attachment without return response in django view

def some view(request):
    with fs.open("filename.pdf") as pdf:
        response = HttpResponse(pdf, content_type='application/pdf')
        response['Content-Disposition'] = "attachment; filename=filename.pdf"
        return response

    # Here I want to redirect to other page
0 Answers
Related