Re: how to do redirects with django?
Hi, def foo(request): return django.http.HttpResponseRedirect(newlocation) newlocation can be an URL. I create them with django.core.urlresolvers.reverse(). Thomas nbv4 schrieb: > If the user goes to /foobar, I want it to redirect him to /foobar-page- > XX, XX being the last page. I have a this in my urlconf" > > (r'^foobar/ > $', > 'project.main.views.foobar_no_page', ), > (r'^foobar-page-(?P\d{1,4})/$', > 'project.main.views.foobar', ), > > foobar() in my views in my main function, foobar_no_page() is have set > as: > > def logbook_no_page(request): > > return HttpResponse(location='/foobar-page-55') > > > but that obviously doesn't work. How can I do this? > > -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ 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: how to do redirects with django?
http://docs.djangoproject.com/en/dev/ref/request-response/#httpresponse-subclasses http://docs.djangoproject.com/en/dev/ref/contrib/redirects/#ref-contrib-redirects On Tue, Dec 9, 2008 at 16:25, nbv4 <[EMAIL PROTECTED]> wrote: > > If the user goes to /foobar, I want it to redirect him to /foobar-page- > XX, XX being the last page. I have a this in my urlconf" > > (r'^foobar/ > $', > 'project.main.views.foobar_no_page', ), > (r'^foobar-page-(?P\d{1,4})/$', > 'project.main.views.foobar', ), > > foobar() in my views in my main function, foobar_no_page() is have set > as: > > def logbook_no_page(request): > >return HttpResponse(location='/foobar-page-55') > > > but that obviously doesn't work. How can I do this? > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
how to do redirects with django?
If the user goes to /foobar, I want it to redirect him to /foobar-page- XX, XX being the last page. I have a this in my urlconf" (r'^foobar/ $', 'project.main.views.foobar_no_page', ), (r'^foobar-page-(?P\d{1,4})/$', 'project.main.views.foobar', ), foobar() in my views in my main function, foobar_no_page() is have set as: def logbook_no_page(request): return HttpResponse(location='/foobar-page-55') but that obviously doesn't work. How can I do this? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---