Debian Codegraph @

django/contrib/contenttypes/apps.py

raw
1 from django.apps import AppConfig
2 from django.contrib.contenttypes.checks import (
3 check_generic_foreign_keys,
4 check_model_name_lengths,
5 )
6 from django.core import checks
7 from django.db.models.signals import post_migrate, pre_migrate
8 from django.utils.translation import gettext_lazy as _
9
10 from .management import create_contenttypes, inject_rename_contenttypes_operations
11
12
13 class ContentTypesConfig(AppConfig):
14 default_auto_field = "django.db.models.AutoField"
15 name = "django.contrib.contenttypes"
16 verbose_name = _("Content Types")
17
18 def ready(self):
19 pre_migrate.connect(inject_rename_contenttypes_operations, sender=self)
20 post_migrate.connect(create_contenttypes)
21 checks.register(check_generic_foreign_keys, checks.Tags.models)
22 checks.register(check_model_name_lengths, checks.Tags.models)