Question: is it possible to redirect the page while sending the email. It takes 5 to 10 seconds for the mail to be sent. During this time, the page is not doing anything. Users might resubmit the form to prompt a reaction. So I was thinking maybe there's a way to redirect the page right after the object is saved instead of redirecting after the mail is sent. Code below:
@login_required
def handle_order(request, **kwargs):
....
order = form.save(commit=False)
order.active = True
order.save()
# send email to the user, 5-10 seconds waiting time
kwargs = {...}
mail_order_detail(**kwargs)
return redirect('shopping:show-order', order.ref_number)
I've tried to use post_save
signal, not working, still have to wait before being redirected