Hey guys-

I've been using Django 1.2's new messages framework a lot lately, and
it's awesome. but, i think I may have discovered a bug (or possibly
I'm doing something wrong, but if so, I sure as hell can't figure out
what it is). It seems to me the messages are never delivered to the
user when there's an HttpResponseRedirect after the message is set.
For example:

def checkin(request, venue_id):
  venue = get_object_or_404(Venue, id=venue_id)
  checkin = CheckIn(singer=request.singer, venue=venue,
date_created=datetime.datetime.now())
  checkin.save()
  message = "Skadoosh! You're checked in to %s." % venue.name
  messages.success(request, message)
  return HttpResponseRedirect(request.META['HTTP_REFERER'])

This doesn't work. When the user is redirected, they don't see the
message. On the other hand, this works fine:

def checkin(request, venue_id):
  venue = get_object_or_404(Venue, id=venue_id)
  checkin = CheckIn(singer=request.singer, venue=venue,
date_created=datetime.datetime.now())
  checkin.save()
  message = "Skadoosh! You're checked in to %s." % venue.name
  messages.success(request, message)
  return render_to_response("path/to/template.html", { 'message':
message }, context_instance=RequestContext(request))

This is all using the default backend (LegacyFallbackStorage).

Thoughts? Bug, or am I doing something wrong? Thanks in advance, all!

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

Reply via email to