2014-01-05 05:49:35 +08:00
|
|
|
from django.apps import AppConfig
|
2015-12-10 20:45:21 +08:00
|
|
|
from django.contrib.admin.checks import check_admin_app, check_dependencies
|
2015-01-28 20:35:27 +08:00
|
|
|
from django.core import checks
|
2017-01-27 03:58:33 +08:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2014-01-05 05:49:35 +08:00
|
|
|
|
|
|
|
|
2014-01-25 05:43:00 +08:00
|
|
|
class SimpleAdminConfig(AppConfig):
|
|
|
|
"""Simple AppConfig which does not do automatic discovery."""
|
|
|
|
|
2020-07-12 20:59:57 +08:00
|
|
|
default_auto_field = 'django.db.models.AutoField'
|
2016-12-30 01:51:26 +08:00
|
|
|
default_site = 'django.contrib.admin.sites.AdminSite'
|
2014-01-05 05:49:35 +08:00
|
|
|
name = 'django.contrib.admin'
|
2014-03-06 23:03:25 +08:00
|
|
|
verbose_name = _("Administration")
|
2014-01-19 02:34:54 +08:00
|
|
|
|
|
|
|
def ready(self):
|
2015-12-10 20:45:21 +08:00
|
|
|
checks.register(check_dependencies, checks.Tags.admin)
|
2014-11-05 14:01:49 +08:00
|
|
|
checks.register(check_admin_app, checks.Tags.admin)
|
2014-01-25 05:43:00 +08:00
|
|
|
|
|
|
|
|
|
|
|
class AdminConfig(SimpleAdminConfig):
|
|
|
|
"""The default AppConfig for admin which does autodiscovery."""
|
|
|
|
|
2020-07-21 16:35:12 +08:00
|
|
|
default = True
|
|
|
|
|
2014-01-25 05:43:00 +08:00
|
|
|
def ready(self):
|
2017-01-21 21:13:44 +08:00
|
|
|
super().ready()
|
2014-01-19 02:34:54 +08:00
|
|
|
self.module.autodiscover()
|