Files
Hulumath-Web/backend/common/apps.py
T
Jacky 43e425edbe
CI / test (push) Canceled after 4m2s
v 0.3 Preview: Update admin
2026-08-08 21:47:29 +08:00

27 lines
788 B
Python

from django.apps import AppConfig
from django.contrib.admin import apps as admin_apps
class CommonConfig(AppConfig):
default = True
default_auto_field = "django.db.models.BigAutoField"
name = "common"
verbose_name = "系统"
def ready(self):
from django.contrib import admin
from .admin_site import HulumathAdminSite
for model in admin.site._registry:
key = f"{model._meta.app_label}.{model._meta.model_name}"
label = HulumathAdminSite.MODEL_LABELS.get(key)
if label:
model._meta.verbose_name = label
model._meta.verbose_name_plural = label
class HulumathAdminConfig(admin_apps.AdminConfig):
default = False
default_site = "common.admin_site.HulumathAdminSite"