Keeping custom sign_up class and importing allauth forms in same forms.py file causing import errors

前端 未结 1 1818
遇见更好的自我
遇见更好的自我 2021-01-24 02:23
from django import forms
from allauth.account.forms import (LoginForm, ChangePasswordForm,
                               ResetPasswordForm, SetPasswordForm, ResetPasswo         


        
1条回答
  •  生来不讨喜
    2021-01-24 03:00

    This happens because allauth tries to import the given module/class you specified as signup form in your settings.py in its account/forms.py. (See forms.py#L186 @ github)

    When you override other forms like ChangePasswordForm in your settings.py by importing allauth's account/forms.py, circular import happens because allauth has already imported your forms.py in its forms.py

    To avoid this, simply move your singup form to a separate signupform.py and change the settings accordingly. It'll work.

    0 讨论(0)
提交回复
热议问题