# urls.py
(r'^ThankYou/(?P<ty_msg_id>\d{4})/$', views.ThankYou),
# message defs in views.py
# messages for ThankYou page
ty_messages = {
'0000' : 'Invalid message specified.',
'0001' : 'Pending dealer record has been re-saved, awaiting
approval.',
'0002' : 'Pending dealer record has been saved, awaiting
approval.',
...
}
# function in views.py
def ThankYou(request, ty_msg_id):
c = Context({
'request' : request,
'show_admin' : request.user.is_authenticated(),
'ty_message' : ty_messages.get(ty_msg_id,
ty_messages['0000']),
})
t = get_template('ThankYou.html')
html = t.render(c)
return HttpResponse(html)
# usage example
return HttpResponseRedirect('/ThankYou/0089')
--Jeff
On Aug 6, 8:33 am, bagheera <neost...@go2.pl> wrote:
> I have two pages with two different forms. Each, if validated, redirects
> to "thanks" page. I want to customize this behavior, so "thanks" page
> should display different message, regarding witch form was invoked, or
> redirects to "/' if no redirection took place (like user typed in browser
> "test.com/thanks")
> Unfortunately, HttpResponseRedirect takes only one argument. How can i
> pass right message anyway? Or mb there is some workaround, like i could
> check in "thanks" view, from what page it was redirected?
>
> --
> Linux user
--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment