Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>allauth.account.adapter.DefaultAccountAdapter does not provide a method called "get_login_redirect_url", so the method in your custom adapter never gets called.</p> <p>This method is located in allauth.utils.py</p> <p>Two possible solutions:</p> <ul> <li>Redirect twice: redirect to some view where you do the work on your url and then redirect again. imo this is the "easy to implement" solution but ppl might find it a bad one.</li> </ul> <p>OR</p> <ul> <li>Create a custom login form derived from <strong>allauth.account.forms.LoginForm</strong> and overwrite the login method. This method returns <em>the final response object</em>.</li> </ul> <p>For this solution you need to use a custom login view. In your custom login view call the allauth login view with your login-form class set in the "form_class"-parameter. see <strong>allauth.account.views.login</strong> for details. </p> <p>code summary (the provided code is not tested and written in the small stackoverflow window so it will definetily not work copy'n'paste, its just a small "howto"-guide to clarify the goal)</p> <p>urls.py:</p> <pre><code>urlpatterns = patterns('', ... (r'^accounts/login/', my_login_view), (r'^accounts/', include('allauth.urls')), ... ) </code></pre> <p>forms.py</p> <pre><code>from allauth.account.forms import LoginForm as AllauthLoginForm class MyCustomLoginForm(AllauthLoginForm) def login(self, request, redirect_url=None): # the original response response = super(MyCustomLoginForm, self).login(request, redirect_ur) if self.user.is_authenticated(): r = settings.LOGIN_REDIRECT_URL.format( username=self.user.username) else: r = "/" return HttpResponseRedirect(r) </code></pre> <p>views.py</p> <pre><code>from allauth.account.views import login as allauth_login def my_login_view(request): return allauth_login(request, form_class=MyCustomLoginForm) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload