在 Django admin 上注册时更改模块的标签

Changing the label for the module when registering on Django admin

我有一个名为 book_author_publisher_category 的包(Django 应用程序)。这个名字只是为了澄清,因为我在这个应用程序中有这四个模型,因为它们有一些限制。

有没有办法更改包含我在管理员中注册的这些模型的部分的标签?

我的book_author_publisher_category/admin.py 文件是这样的:

from django.contrib import admin
from book_author_publisher_category.models import *

# Registering the models on admin site
admin.site.register([Publisher, Author, Category, Book])

我在后台注册的模型部分被命名为应用程序名称。我该如何定制?

您应该更改应用的 verbose name

book_author_publisher_category/apps.py

from django.apps import AppConfig

class BAPCConfig(AppConfig):
    name = 'book_author_publisher_category'
    verbose_name = "Book's data"

book_author_publisher_category/__init__.py

default_app_config = 'book_author_publisher_category.apps.BAPCConfig'