def line_strain_changed(sender, instance, action, reverse, model, pk_set, using, **kwargs):
"""
Handles changes to the Line <-> Strain relationship caused by adding/removing/changing the
strain associated with a single line in a study. Detects changes that indicate a need to push
changes across to ICE for the (ICE part -> EDD study) link stored in ICE.
"""
# only care about changes in the forward direction, Line -> Strain
if reverse or check_ice_cannot_proceed():
return
# only execute these signals if using a non-testing database
if using in settings.DATABASES:
action_function = {
'post_add': strain_added,
'pre_remove': strain_removing,
'post_remove': strain_removed,
}.get(action, None)
if action_function:
action_function(instance, pk_set)
# ----- helper functions -----
评论列表
文章目录