0

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"

4

1 回答 1

1

不,HTTP 重定向根本不会堆积在浏览器历史记录中,而是它重定向到的页面。

似乎您可以直接从一个订单页面转到另一个页面。你真的想这样做吗?您可以尝试back通过使用 javascript 历史框架来模拟,并手动重定向到提供程序页面,但我不推荐它。只需更好地规划您的导航。

于 2013-11-12T11:36:42.740 回答