【发布时间】:2014-12-17 06:58:37
【问题描述】:
当尝试使用社交帐户登录而该电子邮件已存在帐户时,将显示以下消息:
An account already exists with this e-mail address. Please sign in to that account first, then connect your Google account.
现在我想更改该消息。起初我试图覆盖 ACCOUNT_SIGNUP_FORM_CLASS = 'mymodule.forms.MySignupForm' 并给它我自己的 raise_duplicate_email_error 方法,但从未调用过该方法。
表格如下所示:
class SignupForm(forms.Form):
first_name = forms.CharField()
last_name = forms.CharField()
boolflag = forms.BooleanField()
def raise_duplicate_email_error(self):
# here I tried to override the method, but it is not called
raise forms.ValidationError(
_("An account already exists with this e-mail address."
" Please sign in to that account."))
def signup(self, request, user):
# do stuff to the user and save it
所以问题是:如何更改该消息?
【问题讨论】:
标签: django django-allauth