You can access the page that they were previously on using
HttpRequest.META['HTTP_REFERER'].  You'll probably need to persist it
in a session so you still have access to it after they submit their
login credentials (otherwise HTTP_REFERER would be the login page).
I'm not sure if HTTP_REFERER can be abused or not (i.e. CSRF), but as
a precaution you might consider just using the path from HTTP_REFERER.

On Jul 31, 8:15 am, When ideas fail <andrewkenyon...@gmail.com> wrote:
> I was wondering if there was a way to redirect users after login to
> the page they where looking at before they logged in.
>
> So if they where on "/blog/" when they logged in they could be
> redirected back and if they where on "/about_us/" they could be
> redirected to "/about_us/"?
>
> I'd appreciate any help, thanks

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to