You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

apps.py 766B

123456789101112131415161718192021222324
  1. from django.apps import AppConfig
  2. from django.contrib.admin.checks import check_admin_app, check_dependencies
  3. from django.core import checks
  4. from django.utils.translation import gettext_lazy as _
  5. class SimpleAdminConfig(AppConfig):
  6. """Simple AppConfig which does not do automatic discovery."""
  7. default_site = 'django.contrib.admin.sites.AdminSite'
  8. name = 'django.contrib.admin'
  9. verbose_name = _("Administration")
  10. def ready(self):
  11. checks.register(check_dependencies, checks.Tags.admin)
  12. checks.register(check_admin_app, checks.Tags.admin)
  13. class AdminConfig(SimpleAdminConfig):
  14. """The default AppConfig for admin which does autodiscovery."""
  15. def ready(self):
  16. super().ready()
  17. self.module.autodiscover()