我从django-allauth获取此内容以进行唯一的用户名检查。
%(model_name)s with this %(field_label)s already exists.
在线快速搜索显示电子邮件错误已解决,可以使用以下内容覆盖:
from django.utils.translation import ugettext_lazy as _
from allauth.account.adapter import DefaultAccountAdapter
class CustomAccountAdapter(DefaultAccountAdapter):
# Overrides default adapter
def __init__(self, request=None):
super(CustomAccountAdapter, self).__init__(request)
self.error_messages['email_taken'] = _('A user is already registered with this e-mail address.')
但是,以这种方式覆盖适配器并不适用于用户名。任何人都可以帮忙解决这个问题,这是唯一阻止我立即上线的事情......