'Is there a way I can pass the context using return redirect in Django?
I wanted to pass the context using return redirect since using return render will send the post again when refreshing the page.
This is my code for my return render:
context = {
'file_path': file_path+'reviews_processed.csv',
'file_name': 'reviews_processed.csv',
}
messages.add_message(request, messages.SUCCESS, 'Processing done!')
return render(request, 'vlookup/vlookup.html', context)
and this is what I am trying to achieve:
# return redirect(vlookup, context)
Thanks!
Solution 1:[1]
You can use django messages or session for showing your custom context or message after successfully redirect. somethings will be like that
messages.add_message(request, messages.SUCCESS, 'Processing done!')
return redirect('your redirect page url')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | boyenec |
