Only trigger group update for saved users

This commit is contained in:
Adarnof 2017-01-03 20:43:35 -05:00 committed by GitHub
parent a561862911
commit 1887d612e6

View File

@ -50,7 +50,7 @@ def m2m_changed_user_groups(sender, instance, action, *args, **kwargs):
if auth.smf_username: if auth.smf_username:
update_smf_groups.delay(instance.pk) update_smf_groups.delay(instance.pk)
if action == "post_add" or action == "post_remove" or action == "post_clear": if instance.pk and (action == "post_add" or action == "post_remove" or action == "post_clear"):
logger.debug("Waiting for commit to trigger service group update for %s" % instance) logger.debug("Waiting for commit to trigger service group update for %s" % instance)
transaction.on_commit(trigger_service_group_update) transaction.on_commit(trigger_service_group_update)