27 lines
788 B
Python
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"
|