Override Django allauth signup “next” redirect URL

前端 未结 1 1328
孤城傲影
孤城傲影 2020-12-31 07:27

Suppose a user is on the page /some_url/ on a site with django-allauth. When clicking \"Login\" they get sent to a URL like:

/accounts/login/?ne         


        
相关标签:
1条回答
  • 2020-12-31 08:17

    The simplest way would be to override the template account/signup.html with your own copy. If you examine that template you will see the following section:

    {% if redirect_field_value %}
    <input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
    {% endif %}
    

    If you remove the if/endif part and change the value inside, the signup page will redirect to a specific page, even if you pass a next argument in the URL:

    <input type="hidden" name="{{ redirect_field_name }}" value="/onboarding/" />
    
    0 讨论(0)
提交回复
热议问题