HttpResponseRedirect and user message

517 views
Skip to first unread message

xpanta

unread,
May 4, 2010, 3:35:27 AM5/4/10
to Django users
Hi,

I am new to django, and I have this simple task i need to accomplish.

in views.py there is a function that processes an html form (with POST
action). This function returns an HttpResponseRedirect object. This
object gets as parameters the redirect action, like this: return
HttpResponseRedirect('/city/%s/%s/' % (username,city))

Is there any way to add some extra fields, like a message to display
to the user? (i.e. "Settings have been saved, successfully!")

hope this makes sense,
Chris

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

ge...@aquarianhouse.com

unread,
May 4, 2010, 4:27:27 AM5/4/10
to Django users
i would use reverse and redirect to a "success" page

def my_view(request):
#do stufff
#save info in session
return HttpResponseRedirect(reverse('success_url'))

def my_success_view(request):
#access the session and get the data
return render_to_response('success.html', locals())

xpanta

unread,
May 4, 2010, 4:43:59 AM5/4/10
to Django users
Thank you. One more thing: how to save info in the session?


On 4 Μάϊος, 11:27, "ge...@aquarianhouse.com" <ge...@aquarianhouse.com>
wrote:

Daniel Roseman

unread,
May 4, 2010, 7:12:33 AM5/4/10
to Django users
On May 4, 9:43 am, xpanta <xpa...@gmail.com> wrote:
> Thank you. One more thing: how to save info in the session?

Read the fine documentation:
http://docs.djangoproject.com/en/1.1/topics/http/sessions/
--
DR.
Reply all
Reply to author
Forward
0 new messages