Question

I have a page that user can place an order via a model form. The post method is the same page.

path

domain/provider/order/3

meaning add an order for provider 3

view is like this

def place_order(request, provider_id):
    form = OrderForm()
    if request.method=="POST":
        if form.is_valid():
            #do something with model and save it
            #redirecting back
            return redirect('providers')

    return render_to_response('add_order.html', {'form':form}

If i place an order it redirects me as it should back to "providers". But if i go to place an order for a different customer and press back i navigate back to the previous order page(at some point). Doesn't redirect clear the back button history?How can i achieve this kind of behaviour? Llike redirecting to some page and reseting the back button behaviour so the redirected page becomes the first one in the page "stack"

Was it helpful?

Solution

No, HTTP redirect simply is not stacked in the browser history, but the page it redirects to is.

It seems like you can go directly from one order page to another. Do you really want to do that? You could try to emulate the back by using a javascript history framework, and manually redirecting to the providers page, but I wouldn't recommend it. Just plan your navigation better.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top