社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  问与答

菜鸟求助 last_name = models.CharField(_('last name'), max_length=30, blank=True)

msliudongsheng • 10 年前 • 4994 次点击  

last_name = models.CharField(_('last name'), max_length=30, blank=True)

field中_('last name') 这个表示的是什么意思

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/549
 
4994 次点击  
文章 [ 3 ]  |  最新文章 10 年前
Py站长
Reply   •   1 楼
Py站长    10 年前

@msliudongsheng 这是一种多国语言版本的写法,你在语言配置文件里写上 balala的定义,_('')就会寻找相应的语言所对应的定义,以此来实现多语言化。

msliudongsheng
Reply   •   2 楼
msliudongsheng    10 年前

@Django中国社区 我是想问_('balala') 下划线括号是什么语法?比较低级

Py站长
Reply   •   3 楼
Py站长    10 年前
verbose_name
Field.verbose_name
A human-readable name for the field. If the verbose name isn’t given, Django will automatically create it using the field’s attribute name, converting underscores to spaces. See Verbose field names.

https://docs.djangoproject.com/en/dev/ref/models/fields/