Hi all
Nis Jørgensen wrote:
> The argument to HttpResponseRedirect is a url. You seem to be confusing
> it with a template.
OK I can do this:
code ....
# some error occurs
message = 'You have ... tell admin that ....'
return HttpResponseRedirect('error/')
and have in views.py
def error(request, message):
{
return render_to_response('error_page.html', {'message':message})
}
But how to get the message into error() without passing it as a GET?
> If you want to display different content, you need
> to pass a different url or (not recommended) store the data you want to
> display, then display it to the user at the new url
> But if you have the data available, there is no reason to do a redirect.
> Just render the error message etc to the relevant template, then return
> that to the user.
Why I dont want to pass it like this ?message='You have ... tell admin that
....'
is that its long and if the error is something like main?delete=100 but the
user cant
delete that id then a Redirect goes to a nice clean valid URL.
A render_to_response leaves the incorrect URL in the browser.
Mike
--
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---