HttpResponseRedirect doesn't return a template so you just need to add
your message before the redirect:
request.user.message_set.create(message="Your playlist was added
successfully.")

You should implement the display of your messages on your base
template like this:
<ul>{% for message in messages %}<li>{{ message }}</li>{% endfor %}</
ul>

This will display and remove the messages from the message queue.

The RequestContext is needed to make the "messages" variable
available.


There is another solution available here:
http://www.djangosnippets.org/snippets/319/

On Oct 4, 11:50 am, francois <[EMAIL PROTECTED]> wrote:
> On 3 oct, 18:54, "James Bennett" <[EMAIL PROTECTED]> wrote:
>
> >http://www.djangoproject.com/documentation/authentication/#messages
>
> Can I use messages with a  HttpResponseRedirect?
>
> In the example given I need to give the context_instance but how to do
> that with HttpResponseRedirect (which doesn't take any other argument
> that the url) ?
>
> """
> request.user.message_set.create(message="Your playlist was added
> successfully.")
>     return render_to_response("playlists/create.html",
>         context_instance=RequestContext(request))
> """
>
> francois


--~--~---------~--~----~------------~-------~--~----~
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