views:

261

answers:

3

Cant we send a dictionary variable when using HttpResponseRedirect

        render_to_response('edited/display.html',context_instance=RequestContext(request,{'newlist': newlist}))

    //How can the dictionary and the request sent back again

    //sumthing like this

    return HttpResponseRedirect('edited/display.html',context_instance=RequestContext(request,{'newlist': newlist}))
A: 

From the documentation:

The constructor takes a single argument -- the path to redirect to. This can be a fully qualified URL (e.g. 'http://www.yahoo.com/search/') or an absolute URL with no domain (e.g. '/search/').

Ignacio Vazquez-Abrams
+2  A: 

Response redirect as name suggests, redirects the user's browser to new URL, so it doesn't make any sense to pass anything else except the new location in HttpResponseRedirect

If you want to pass some data, so that in the view of new location url you can check for that data pass it as url arguments e.g.

return HttpResponseRedirect('edited/display.html?msg=I was redirected')
Anurag Uniyal
A: 

What you are really looking for, I think is the redirect function introduced in 1.1

You can instead use, for your case,

redirect(view_name,view_parameter)

For that, it may be necessary to modify your view first, to take the new_list parameter, or pass to it, the slug or the id, it takes.

Lakshman Prasad