Re: redirection 2 links back after signing up?
btw this requires that you use render_to_response with the 3rd argument, context_instance=RequestContext(request) see docs. http://docs.djangoproject.com/en/dev/ref/templates/api/?from=olddocs session docs http://docs.djangoproject.com/en/dev/topics/http/sessions/#topics-http-sessions On Nov 23, 9:51 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I just solved this issue. I did by using using sessions. > > I initialize this in a couple of views. > > request.session['last'] = request.get_full_path() > > If a user tries to do something restricted it requires them to login > which I do the same exact way you do. > > After they login they get redirected to what is specified in next.. > fill out a form, yada yada yada. > after success of that I then do this. > > return HttpResponseRedirect(request.session['last']) > > hope this helps. > > On Nov 5, 11:08 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > That is the problem I am trying to solve. > > > Basically, the restricted area isn't static. A user could be viewing > > any number of dynamic pages protected by a sign in page. > > > If it were simply a static page, it would be trivial to do: return > > HttpResponseRedirect("/static_page/") > > > The ?next= argument is only used by django's automatic sign-in code. > > I'm not even sure how I could use it myself. Do you have any ideas > > what I should try? > > > Basically: > > > 1) every potential page that has its access restricted must be able to > > pass the current path along to the login page > > 2) The login page needs to send along the same path to the > > create_account page if it is clicked. If it is not clicked, then we > > will return to the current page and no extra code is needed. > > 3) The create account page can now return > > HttpResponseRedirect(previousPath) > > > What is the best way to 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 -~--~~~~--~~--~--~---
Re: redirection 2 links back after signing up?
I just solved this issue. I did by using using sessions. I initialize this in a couple of views. request.session['last'] = request.get_full_path() If a user tries to do something restricted it requires them to login which I do the same exact way you do. After they login they get redirected to what is specified in next.. fill out a form, yada yada yada. after success of that I then do this. return HttpResponseRedirect(request.session['last']) hope this helps. On Nov 5, 11:08 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > That is the problem I am trying to solve. > > Basically, the restricted area isn't static. A user could be viewing > any number of dynamic pages protected by a sign in page. > > If it were simply a static page, it would be trivial to do: return > HttpResponseRedirect("/static_page/") > > The ?next= argument is only used by django's automatic sign-in code. > I'm not even sure how I could use it myself. Do you have any ideas > what I should try? > > Basically: > > 1) every potential page that has its access restricted must be able to > pass the current path along to the login page > 2) The login page needs to send along the same path to the > create_account page if it is clicked. If it is not clicked, then we > will return to the current page and no extra code is needed. > 3) The create account page can now return > HttpResponseRedirect(previousPath) > > What is the best way to 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 -~--~~~~--~~--~--~---
Re: redirection 2 links back after signing up?
That is the problem I am trying to solve. Basically, the restricted area isn't static. A user could be viewing any number of dynamic pages protected by a sign in page. If it were simply a static page, it would be trivial to do: return HttpResponseRedirect("/static_page/") The ?next= argument is only used by django's automatic sign-in code. I'm not even sure how I could use it myself. Do you have any ideas what I should try? Basically: 1) every potential page that has its access restricted must be able to pass the current path along to the login page 2) The login page needs to send along the same path to the create_account page if it is clicked. If it is not clicked, then we will return to the current page and no extra code is needed. 3) The create account page can now return HttpResponseRedirect(previousPath) What is the best way to 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 -~--~~~~--~~--~--~---
Re: redirection 2 links back after signing up?
And how about to ignore `next` param in `create_account` view and explicitly redirect user to his restricted area? On Wed, Nov 5, 2008 at 17:12, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote: > > Hello, > > I have the following situation: > > 1) User goes to a restricted area and is offered a chance to login > (@login_required decorator used) > 2) User logs in, and then is automatically returned to this page via ? > next={{ request.path }} in the HTML template > > This works fine, after logging in the user is returned to the correct > page. > > The problem is, if the user doesn't already have an account, I get > into this situation: > > 1) User goes to a restricted area and is offered a chance to login > (@login_required decorator used) > 2) User doesn't have an account, so attempts to create one, and clicks > on the 'Create New Account link'. The problem is the link now looks > like: "/create_account/?next=/Sign_In/" > 3) After creating the account, the user is redirected to the sign in > page, but _not the page they visted 2 steps back_ > > Is there an ideal way to fix this? Basically, if you click on 'create > an account' from the sign_in page, there should be some way to return > to the page you were at before being directed to the sign in page. > > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---