Re: Manipulating URLs
Tons of good karma to you both :) really appreciate it.. Thanks! On Jun 23, 1:02 am, Tye <[EMAIL PROTECTED]> wrote: > I knew I'd write a long, pseudo-detailed post, just to turn around and > find something so very simple. > > I knew it! > > Thanks Matthias :-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Manipulating URLs
I knew I'd write a long, pseudo-detailed post, just to turn around and find something so very simple. I knew it! Thanks Matthias :-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Manipulating URLs
On Mon, 2008-06-23 at 00:45 -0700, Tye wrote: > [...] > > def message_send(request) > # primary message_send logic goes here > # . . . > > if success: > return HttpResponseRedirect('/message/success/') > else: > if failed_this_way: > return HttpResponseRedirect( > '/message/failed/this_way') > if failed_that_way: > return HttpResponseRedirect( > '/message/failed/that_way') > else failed_spectacularly: > return HttpResponseRedirect( > '/message/failed/spectacularly') > Or use the messages system from django.contrib.auth: http://www.djangoproject.com/documentation/authentication/#messages --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Manipulating URLs
@shravster – In urls.py, have something like this: # urls.py from django.conf.urls.defaults import * from mysite import views as root urlpatterns = patterns('', (r'^message/send/$', root.message_send), (r'^message/failed/(?P)/$', root.message_failed), (r'^message/succeeded/$', root.message_succeeded), ) And your view functions would look like this: # views.py from django.http import HttpResponseRedirect from django.shortcuts import render_to_response def message_send(request) # primary message_send logic goes here # . . . if success: return HttpResponseRedirect('/message/success/') else: if failed_this_way: return HttpResponseRedirect( '/message/failed/this_way') if failed_that_way: return HttpResponseRedirect( '/message/failed/that_way') else failed_spectacularly: return HttpResponseRedirect( '/message/failed/spectacularly') def message_failed(request, error_message): template = "%s.html" % error_message render_to_response(template) def message_success(request): # balloons and confetti Here's an idea: message_failed's template could {% include "message_send.html" %} or something more effective, to allow the user to see the error and then – while in the same page – re-send a message. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---