Django: Redirect after HttpResponse

I am generating a report download in a view and starting the download after processing the POST data. That means the user sends a form and the download starts:

def export(request):
    if request.method == 'POST' and 'export_treat' in request.POST: 
        form1 = TransExport(request.POST, instance= obj)
        if form1.is_valid():
            response['Content-Disposition'] = 'attachment; filename="Report_Behandlungen.xls"'
            return response

What I need is a page refresh after the download (or a redirect). How can I achieve this?


I would just do it in simple logic with javascript:

user clicks the link


and comes to /file_downloaded/ where the download starts and after 3 seconds, you just redirect the page via js


to detect if the download is ready is not easy

Need Your Help

Difference between `initLoader` and `restartLoader` in `LoaderManager`

java android android-loadermanager

I'm completely lost regarding the differences between the initLoader and the restartLoader functions of the LoaderManager:

Can a Complication access Healthkit when the watch screen is off?

swift watchkit core-motion watch-os-2 health-kit

If the watch screen is off and the periodic Complication reload happens, can HealthKit be accessed? What about CMPedometer?