0

My form submits as follows

<form class="form-signin" role="form" action="{% provider_login_url "facebook" method="js_sdk" next="/next"%}">

I overrode the DefaultAccountAdapter with my own AccountAdapter with method

def get_login_redirect_url(self, request):
    print request.GET['next']
    ...

But request loses the next parameter and the print returns an error because there is no "next" in request.GET. Why can't I access the next parameter? I was originally using get_login_redirect_url to handle different url redirects after creation of social versus username/password users. Now, I need to be able to specific the next parameter in the URL for another variant of behavior for social user login but am unable to access the next parameter because it does not seem to be passed.

user2364214
  • 313
  • 3
  • 10

2 Answers2

0

I am not sure whether I could give the precise solution for your issue. But I think got the point.

To access the next parameter from url, The url should be,

http://127.0.0.1:8000/index?next=2

If you have to form the url in this above manner,you can get access to the next argument from request object in your corresponding view method

print request.GET.get('next')

So, please make sure to format request url with proper querystring refer

To your case,

I have no idea about {% provider_login_url %} template tag

I am assuming after your tag rendered it yields the url index, then i am appending my querystring next

<form class="form-signin" role="form" action="/index?next=someValue">

you may try additionally,

{% provider_login_url "facebook" next=next %}    

source

Community
  • 1
  • 1
Nava
  • 6,276
  • 6
  • 44
  • 68
0

I came across with a similar problem. However, I wasn't signing in with facebook. request.GET was always empty.

I think you could try using jQuery to manually append next parameter to the action attribute of <form>. See this question. It solves my problem.

Community
  • 1
  • 1
Tao Huang
  • 1,181
  • 1
  • 9
  • 14