Michael Lake skrev:
> Hi all
>
> A really simple question:
>
> I'm mostly using code like this:
>       data = {'message': 'Some message to user...'}
>       return render_to_response('main.html', data)
>
> But for error messages to users if one wishes to use a redirect like this:
>       return HttpResponseRedirect('/error_page.html')
>
> How can one add data into this page? The Redirect is nice in that it does not 
> show 
> the old URL which might be quite wrong - hence the error.
>
> The Django docs say that HttpResponseRedirect('/whatever/url/') takes just 
> one 
> argument. I'd like to use one error_page.html template for a range of errors.
>
> Do people use maybe HttpResponseRedirect('error/') where error is some 
> defined 
> function and somehow pass a message string to it?
The argument to HttpResponseRedirect is a url. You seem to be confusing
it with a template. 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.

Nis Jorgensen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to