Django学习——如何在xadmin后台中models名字显示中文

1.在setting中注册app时

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'DjangoUeditor',
    'users.apps.UsersConfig',
    'goods.apps.GoodsConfig',
    'user_operation.apps.UserOperationConfig',
    'trade.apps.TradeConfig',
    'crispy_forms',
    'xadmin'

]

2.在app中的apps文件里加入verbose_name

class GoodsConfig(AppConfig):
    name = 'goods'
    verbose_name = "商品"

你可能感兴趣的:(Django学习)