Py学习  »  Python

_(str)在Python中,意思是两者[副本]

Atom • 6 年前 • 2238 次点击  

我是python的初学者。现在我正在做一个Django项目。 我看到许多代码行包含 _('password') , _('last_login') 等。 检查以下代码:


    username = models.CharField(
        _('username'),
        max_length=150,
        unique=True,
        help_text=_('Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.'),
        validators=[username_validator],
        error_messages={
            'unique': _("A user with that username already exists."),
        },
    )

有什么用 _('username') ?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/52391
文章 [ 1 ]  |  最新文章 6 年前