本文整理匯總了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)