2016-07-25 69 views
1

我正在使用django allauth。MultiValueDictKeyError - 傳遞GET參數

我的所有用戶都應該有權訪問動態生成的網址。例如:www.example.com/uuid/

從此頁面他們應該可以使用Soundcloud登錄,並且應該在連接後重定向到此頁面。

我正在使用以下獲取以前的鏈接,但我收到一個很好的網址在html中,但在django上是空的。

#Html 
<a href="/accounts/soundcloud/login?process=login?next={{request.path}}" name="next" value="next" class="waves-effect waves-light btn-large" style="margin-bottom: 10px;">Download</a> 

#adapter.py 
class AccountAdapter(DefaultAccountAdapter): 

def get_login_redirect_url(self, request): 
    #assert request.user.is_authenticated() 
    #pass 
    return request.GET['next'] 

回答

1

您的網址中有錯字 - 它應該是:

href="/accounts/soundcloud/login?process=login&next={{request.path}}" 

通知的&而不是第二?

+0

謝謝!我只是注意到這一點,並嘗試使用/accounts/soundcloud/login/?next={{request.path}},有什麼區別? – Juanvulcano

+0

@Juanvulcano不包含'process' url參數,但它會包含'next'參數。有關更多詳細信息,請參閱[此答案](http://stackoverflow.com/a/5767509/2532070)。 – YPCrumble