不使用适配器

时间:2015-05-14 17:18:31

标签: django django-allauth

我正在使用allauth 0.19.1。当我尝试使用自定义适配器时,没有任何反应。 我的配置:

ACCOUNT_ADAPTER = 'account.adapters.CustomAccountAdapter'
ACCOUNT_USER_MODEL_USERNAME_FIELD = 'email'
ACCOUNT_USER_MODEL_EMAIL_FIELD = 'email'
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_UNIQUE_EMAIL = True
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_SIGNUP_FORM_CLASS = 'account.forms.SignupForm'

我的适配器:

class CustomAccountAdapter(DefaultAccountAdapter):

    def get_login_redirect_url(self, request):
        import pdb
        pdb.set_trace()
        path = "/accounts/{username}/"
        return path.format(username=request.user.username)

另外,我尝试使用信号,但结果是相同的

@receiver(user_logged_in)
def registered_user_login(sender, **kwargs):
    import pdb
    pdb.set_trace()
    instance = User.objects.get_by_natural_key(kwargs['user'])

0 个答案:

没有答案