python - 用flask-security 写的登录,注册。怎么修改成中文?
PHP中文网
PHP中文网 2017-04-18 09:48:36
0
1
528

代码:
from flask_security import forms as security_forms
from flask_wtf import FlaskForm
from wtforms.fields import TextField, TextAreaField
from wtforms.validators import Required
from flask_babel import gettext as _

def unique_username(form, field):

if security_forms._datastore.find_user(nickname=field.data) is not None:
    msg = security_forms.get_message(
            'EMAIL_ALREADY_ASSOCIATED', email=field.data)[0]
    raise security_forms.ValidationError(msg)

class ExtendedRegisterForm(security_forms.RegisterForm):

nickname = TextField(
        _(u'用户名'), [security_forms.Required(), unique_username])

class SearchForm(FlaskForm):

search = TextField(_('search'), validators=[Required()])

class ReviewForm(FlaskForm):

review = TextAreaField(_('review'), validators=[Required()])
PHP中文网
PHP中文网

认证0级讲师

reply all(1)
伊谢尔伦

I found a way to die, which is to change it directly in the background:

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!