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


Python m2m_changed.connect方法代码示例

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


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

示例1: connect_signals

# 需要导入模块: from django.db.models.signals import m2m_changed [as 别名]
# 或者: from django.db.models.signals.m2m_changed import connect [as 别名]
def connect_signals(self):
        """
        * m2m validation before templates are added/removed to a config
        * automatic vpn client management on m2m_changed
        * automatic vpn client removal
        """
        m2m_changed.connect(
            self.config_model.clean_templates,
            sender=self.config_model.templates.through,
        )
        m2m_changed.connect(
            self.config_model.templates_changed,
            sender=self.config_model.templates.through,
        )
        m2m_changed.connect(
            self.config_model.manage_vpn_clients,
            sender=self.config_model.templates.through,
        )
        post_delete.connect(
            self.vpnclient_model.post_delete, sender=self.vpnclient_model
        ) 
开发者ID:openwisp,项目名称:openwisp-controller,代码行数:23,代码来源:apps.py

示例2: register_signals

# 需要导入模块: from django.db.models.signals import m2m_changed [as 别名]
# 或者: from django.db.models.signals.m2m_changed import connect [as 别名]
def register_signals():
    from c3nav.mapdata.models.geometry.base import GeometryMixin
    for model in get_submodels(GeometryMixin):
        post_delete.connect(geometry_deleted, sender=model)

    from c3nav.mapdata.models.locations import SpecificLocation
    for model in get_submodels(SpecificLocation):
        m2m_changed.connect(locationgroup_changed, sender=model.groups.through) 
开发者ID:c3nav,项目名称:c3nav,代码行数:10,代码来源:changes.py

示例3: ready

# 需要导入模块: from django.db.models.signals import m2m_changed [as 别名]
# 或者: from django.db.models.signals.m2m_changed import connect [as 别名]
def ready(self):
        from c3nav.editor.models import ChangeSet
        from c3nav.editor.signals import set_changeset_author_on_login
        post_save.connect(ChangeSet.object_changed_handler)
        post_delete.connect(ChangeSet.object_changed_handler)
        m2m_changed.connect(ChangeSet.object_changed_handler)
        user_logged_in.connect(set_changeset_author_on_login) 
开发者ID:c3nav,项目名称:c3nav,代码行数:9,代码来源:apps.py

示例4: connect_signals

# 需要导入模块: from django.db.models.signals import m2m_changed [as 别名]
# 或者: from django.db.models.signals.m2m_changed import connect [as 别名]
def connect_signals():
    post_save.connect(receiver=reassess_on_profile_save, sender=UserProfile)
    pre_save.connect(receiver=signals.pre_save_config, sender=AutogroupsConfig)
    pre_delete.connect(receiver=signals.pre_delete_config, sender=AutogroupsConfig)
    post_save.connect(receiver=signals.check_groups_on_profile_update, sender=UserProfile)
    m2m_changed.connect(receiver=signals.autogroups_states_changed, sender=AutogroupsConfig.states.through) 
开发者ID:allianceauth,项目名称:allianceauth,代码行数:8,代码来源:__init__.py

示例5: connect_signals

# 需要导入模块: from django.db.models.signals import m2m_changed [as 别名]
# 或者: from django.db.models.signals.m2m_changed import connect [as 别名]
def connect_signals(cls):
        m2m_changed.connect(m2m_changed_user_groups, sender=User.groups.through)
        m2m_changed.connect(m2m_changed_group_permissions, sender=Group.permissions.through)
        m2m_changed.connect(m2m_changed_user_permissions, sender=User.user_permissions.through)
        m2m_changed.connect(m2m_changed_state_permissions, sender=State.permissions.through)
        pre_save.connect(disable_services_on_inactive, sender=User)
        m2m_changed.connect(state_member_corporations_changed, sender=State.member_corporations.through)
        m2m_changed.connect(state_member_characters_changed, sender=State.member_characters.through)
        m2m_changed.connect(state_member_alliances_changed, sender=State.member_alliances.through)
        post_save.connect(state_saved, sender=State) 
开发者ID:allianceauth,项目名称:allianceauth,代码行数:12,代码来源:auth_utils.py


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