本文整理汇总了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
)
示例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)
示例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)
示例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)
示例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)