我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用django.db.models.signals.post_migrate.connect()。
def ready(self): # Monkey-patch `RedirectNodeAdmin` to replace `fieldsets` attribute # with `base_fieldsets` to avoid infinitie recursion bug when using # django-polymorphic versions >= 0.8 and < 1.1, see: # https://github.com/django-fluent/django-fluent-pages/issues/110 from django.conf import settings if 'fluent_pages.pagetypes.redirectnode' in settings.INSTALLED_APPS: from fluent_pages.pagetypes.redirectnode.admin \ import RedirectNodeAdmin if getattr(RedirectNodeAdmin, 'fieldsets', None): RedirectNodeAdmin.base_fieldsets = RedirectNodeAdmin.fieldsets RedirectNodeAdmin.fieldsets = None # Connect signal handlers. post_migrate.connect(update_site, sender=self) # Import plugins from installed apps. autodiscover_modules('plugins')
def ready(self): post_migrate.connect(create_default_site, sender=self)
def ready(self): from .signals.handlers import ( m2m_changed_handler, post_migrate_handler, post_save_handler, pre_delete_handler ) m2m_changed.connect(receiver=m2m_changed_handler, dispatch_uid='chemtrails.signals.handlers.m2m_changed_handler') post_save.connect(receiver=post_save_handler, dispatch_uid='chemtrails.signals.handlers.post_save_handler') pre_delete.connect(receiver=pre_delete_handler, dispatch_uid='chemtrails.signals.handlers.pre_delete_handler') post_migrate.connect(receiver=post_migrate_handler, dispatch_uid='neomodel.core.post_migrate_handler') # Neo4j config config.DATABASE_URL = getattr(settings, 'NEO4J_BOLT_URL', os.environ.get('NEO4J_BOLT_URL', config.DATABASE_URL)) config.FORCE_TIMEZONE = getattr(settings, 'NEO4J_FORCE_TIMEZONE', get_environment_variable('NEO4J_FORCE_TIMEZONE', False)) config.ENCRYPTED_CONNECTION = getattr(settings, 'NEO4J_ENCRYPTED_CONNECTION', get_environment_variable('NEO4J_ENCRYPTED_CONNECTION', True)) config.MAX_POOL_SIZE = getattr(settings, 'NEO4J_MAX_POOL_SIZE', get_environment_variable('NEO4J_MAX_POOL_SIZE', 50))
def ready(self): post_migrate.connect(create_permissions, dispatch_uid="django.contrib.auth.management.create_permissions") checks.register(check_user_model, checks.Tags.models)
def ready(self): post_migrate.connect(update_contenttypes) checks.register(check_generic_foreign_keys, checks.Tags.models)
def ready(self): post_migrate.connect( create_permissions, dispatch_uid="django.contrib.auth.management.create_permissions" ) checks.register(check_user_model, checks.Tags.models) checks.register(check_models_permissions, checks.Tags.models)
def ready(self): pre_migrate.connect(inject_rename_contenttypes_operations, sender=self) post_migrate.connect(update_contenttypes) checks.register(check_generic_foreign_keys, checks.Tags.models)
def ready(self): post_migrate.connect(attach_token_permissions, sender=self)
def ready(self): post_migrate.connect(create_default_groups, sender=self)
def ready(self): pre_migrate.connect(inject_rename_contenttypes_operations, sender=self) post_migrate.connect(create_contenttypes) checks.register(check_generic_foreign_keys, checks.Tags.models)
def ready(self): import cfp.signals # noqa post_migrate.connect(cfp.signals.call_first_site_post_save, sender=self)
def ready(self): from .operations import inject_pre_migration_operations, inject_post_migration_operations pre_migrate.connect(inject_pre_migration_operations, sender=self) post_migrate.connect(inject_post_migration_operations, sender=self)
def ready(self): super().ready() post_migrate.connect(post_migrate_ensure_all_system_groups_exist)
def ready(self): post_migrate.connect(add_permissions, sender=self)
def ready(self): super(AuthConfig, self).ready() post_migrate.connect( create_permissions, dispatch_uid="django.contrib.auth.management.create_permissions" ) checks.register(check_models_permissions, checks.Tags.models)
def ready(self): post_migrate.connect(callback, sender=self)