在模型中加入class Meta即可
class Staff(models.Model):
name = models.CharField(null=True, blank=True, max_length=200)
job = models.CharField(null=True, blank=True, max_length=200)
def __str__(self):
return self.name
class Meta:
verbose_name = '员工'
verbose_name_plural = '员工' #保证取消admin的model的s
如何修改django.admin中一个应用的名称:复制下面的代码放入应用目录下的init.py中即可,通过修改 verbose_name = u’中文名称’
from os import path
from django.apps import AppConfig
VERBOSE_APP_NAME = "YOUR VERBOSE APP NAME HERE"
def get_current_app_name(file):
return path.dirname(file).replace('\\', '/').split('/')[-1]
class AppVerboseNameConfig(AppConfig):
name = get_current_app_name(__file__)
verbose_name = u'中文名称'
default_app_config = get_current_app_name(__file__) + '.__init__.AppVerboseNameConfig'
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有