当前位置: 首页>>代码示例>>Python>>正文


Python post_migrate.connect方法代码示例

本文整理汇总了Python中django.db.models.signals.post_migrate.connect方法的典型用法代码示例。如果您正苦于以下问题:Python post_migrate.connect方法的具体用法?Python post_migrate.connect怎么用?Python post_migrate.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在django.db.models.signals.post_migrate的用法示例。


在下文中一共展示了post_migrate.connect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: retry_handler_registration

# 需要导入模块: from django.db.models.signals import post_migrate [as 别名]
# 或者: from django.db.models.signals.post_migrate import connect [as 别名]
def retry_handler_registration(sender, **kwargs):
    """
    Goes through each of the handlers to retry
    and retries them w/ retry=False
    """

    while len(query_handlers_to_retry):
        qh = query_handlers_to_retry.pop()
        register_query_handler(qh[0], qh[1], retry=False)

    while len(message_handlers_to_retry):
        mh = message_handlers_to_retry.pop()
        print("retrying", mh[0])
        register_message_handler(mh[0], mh[1], retry=False)

# Leaving the sender blank is probably not right, but
# after a few hours digging in django source code i couldn't
# figure out another way to connect this handler so
# it stays this way for now 
开发者ID:TAXIIProject,项目名称:django-taxii-services,代码行数:21,代码来源:management.py

示例2: ready

# 需要导入模块: from django.db.models.signals import post_migrate [as 别名]
# 或者: from django.db.models.signals.post_migrate import connect [as 别名]
def ready(self):
        if django_version() == DjangoVersion.DJANGO_21:
            # Disable silently the package for Django => 2.1. We don't override
            # admin_site neither the default ModelAdmin.
            warnings.warn(
                'The package `admin_view_permission is deprecated in '
                'Django 2.1. Django added this functionality into the core.',
                DeprecationWarning
            )
            return

        if not isinstance(admin.site, AdminViewPermissionAdminSite):
            admin.site = AdminViewPermissionAdminSite('admin')
            admin.sites.site = admin.site

        post_migrate.connect(update_permissions) 
开发者ID:ctxis,项目名称:django-admin-view-permission,代码行数:18,代码来源:apps.py

示例3: prepare

# 需要导入模块: from django.db.models.signals import post_migrate [as 别名]
# 或者: from django.db.models.signals.post_migrate import connect [as 别名]
def prepare(self):
        """Connect testing ``pre_migrate`` and ``post_migrate`` receivers."""
        self.pre_migrate_receiver_mock = mock.MagicMock()
        self.post_migrate_receiver_mock = mock.MagicMock()
        # ``old_apps`` is not real ``ProjectState`` instance, so we cannot use
        # it to get "original" main_app ``AppConfig`` instance needed to
        # connect signal receiver, that's the reason we are using
        # ``apps`` imported directly from ``django.apps``
        self.main_app_config = apps.get_app_config('main_app')
        pre_migrate.connect(
            self.pre_migrate_receiver_mock,
            sender=self.main_app_config,
        )
        post_migrate.connect(
            self.post_migrate_receiver_mock,
            sender=self.main_app_config,
        ) 
开发者ID:wemake-services,项目名称:django-test-migrations,代码行数:19,代码来源:test_signals.py

示例4: ready

# 需要导入模块: from django.db.models.signals import post_migrate [as 别名]
# 或者: from django.db.models.signals.post_migrate import connect [as 别名]
def ready(self):
        pre_migrate.connect(create_index, sender=self)
        post_migrate.connect(reindex, sender=self) 
开发者ID:ideascube,项目名称:ideascube,代码行数:5,代码来源:apps.py

示例5: ready

# 需要导入模块: from django.db.models.signals import post_migrate [as 别名]
# 或者: from django.db.models.signals.post_migrate import connect [as 别名]
def ready(self):
        post_migrate.connect(create_permissions,
            dispatch_uid="django.contrib.auth.management.create_permissions")
        checks.register(check_user_model, checks.Tags.models) 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:6,代码来源:apps.py

示例6: ready

# 需要导入模块: from django.db.models.signals import post_migrate [as 别名]
# 或者: from django.db.models.signals.post_migrate import connect [as 别名]
def ready(self):
        post_migrate.connect(update_contenttypes)
        checks.register(check_generic_foreign_keys, checks.Tags.models) 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:5,代码来源:apps.py

示例7: ready

# 需要导入模块: from django.db.models.signals import post_migrate [as 别名]
# 或者: from django.db.models.signals.post_migrate import connect [as 别名]
def ready(self):
        post_migrate.connect(create_default_site, sender=self) 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:4,代码来源:apps.py

示例8: patch

# 需要导入模块: from django.db.models.signals import post_migrate [as 别名]
# 或者: from django.db.models.signals.post_migrate import connect [as 别名]
def patch():
    post_migrate.connect(_invalidate_on_migration)

    _patch_cursor()
    _patch_atomic()
    _patch_orm() 
开发者ID:noripyt,项目名称:django-cachalot,代码行数:8,代码来源:monkey_patch.py

示例9: ready

# 需要导入模块: from django.db.models.signals import post_migrate [as 别名]
# 或者: from django.db.models.signals.post_migrate import connect [as 别名]
def ready(self):
        post_migrate.connect(
            create_permissions,
            dispatch_uid="django.contrib.auth.management.create_permissions"
        )
        if hasattr(get_user_model(), 'last_login'):
            from .models import update_last_login
            user_logged_in.connect(update_last_login, dispatch_uid='update_last_login')
        checks.register(check_user_model, checks.Tags.models)
        checks.register(check_models_permissions, checks.Tags.models) 
开发者ID:reBiocoder,项目名称:bioforum,代码行数:12,代码来源:apps.py

示例10: ready

# 需要导入模块: from django.db.models.signals import post_migrate [as 别名]
# 或者: from django.db.models.signals.post_migrate import connect [as 别名]
def ready(self):
        post_migrate.connect(
            lambda sender, **kwargs: generate_view_permissions(),
            sender=self,
            weak=False,
        ) 
开发者ID:pengutronix,项目名称:aiohttp-json-rpc,代码行数:8,代码来源:apps.py

示例11: ready

# 需要导入模块: from django.db.models.signals import post_migrate [as 别名]
# 或者: from django.db.models.signals.post_migrate import connect [as 别名]
def ready(self):
        post_migrate.connect(init_db, sender=self) 
开发者ID:infinity1207,项目名称:thirtylol,代码行数:4,代码来源:apps.py

示例12: ready

# 需要导入模块: from django.db.models.signals import post_migrate [as 别名]
# 或者: from django.db.models.signals.post_migrate import connect [as 别名]
def ready(self):
        from django.contrib.sites.models import Site

        from job_board.signals import gen_site_config_post_migrate
        from job_board.signals import gen_site_config_post_save

        post_save.connect(gen_site_config_post_save, sender=Site)
        # NOTE: We list sites before job_board in INSTALLED_APPS, failing to
        #       do that will result in this post_migrate signal firing before
        #       the default site has been created.
        post_migrate.connect(gen_site_config_post_migrate, sender=self) 
开发者ID:tramcar,项目名称:tramcar,代码行数:13,代码来源:apps.py

示例13: ready

# 需要导入模块: from django.db.models.signals import post_migrate [as 别名]
# 或者: from django.db.models.signals.post_migrate import connect [as 别名]
def ready(self) -> None:
        # We import zerver.signals here for the side effect of
        # registering the user_logged_in signal receiver.  This import
        # needs to be here (rather than e.g. at top-of-file) to avoid
        # running that code too early in Django's setup process, but
        # in any case, this is an intentionally unused import.
        import zerver.signals
        zerver.signals

        if settings.POST_MIGRATION_CACHE_FLUSHING:
            post_migrate.connect(flush_cache, sender=self) 
开发者ID:zulip,项目名称:zulip,代码行数:13,代码来源:apps.py

示例14: ready

# 需要导入模块: from django.db.models.signals import post_migrate [as 别名]
# 或者: from django.db.models.signals.post_migrate import connect [as 别名]
def ready(self):
        from ra.utils.permissions import create_report_permissions
        super().ready()
        post_migrate.connect(
            create_report_permissions, sender=self) 
开发者ID:ra-systems,项目名称:django-ra-erp,代码行数:7,代码来源:apps.py

示例15: ready

# 需要导入模块: from django.db.models.signals import post_migrate [as 别名]
# 或者: from django.db.models.signals.post_migrate import connect [as 别名]
def ready(self):
        super(RaConfig, self).ready()
        from .utils.permissions import create_report_permissions
        from . import checks

        post_migrate.connect(
            create_report_permissions, sender=self,
            dispatch_uid="ra.utils.permissions.create_reports_permissions"
        ) 
开发者ID:ra-systems,项目名称:django-ra-erp,代码行数:11,代码来源:apps.py


注:本文中的django.db.models.signals.post_migrate.connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。