Reputation: 34200
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}))
Upvotes: 2
Views: 4597
Reputation: 7650
So let me add another answer additional to existing ones:
my_url = reverse("my_app.views.my_path") + "?action_result=124"
return HttpResponseRedirect(my_url)
reverse function is: from django.core.urlresolvers import reverse
Upvotes: 2
Reputation: 88845
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')
Upvotes: 4
Reputation: 87205
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.
Upvotes: 0
Reputation: 799350
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/').
Upvotes: 0