1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

avoid DB action in signal, confusing logs

This commit is contained in:
AlanCoding 2018-05-04 08:12:40 -04:00
parent a9c9646060
commit 6d7f772e98
No known key found for this signature in database
GPG Key ID: FD2C3C012A72926B

View File

@ -205,7 +205,7 @@ def set_original_organization(sender, instance, **kwargs):
pre-save organization, so we can later determine if the organization
field is dirty.
'''
instance.__original_org = instance.organization
instance.__original_org_id = instance.organization_id
def save_related_job_templates(sender, instance, **kwargs):
@ -217,7 +217,7 @@ def save_related_job_templates(sender, instance, **kwargs):
if sender not in (Project, Inventory):
raise ValueError('This signal callback is only intended for use with Project or Inventory')
if instance.__original_org != instance.organization:
if instance.__original_org_id != instance.organization_id:
jtq = JobTemplate.objects.filter(**{sender.__name__.lower(): instance})
for jt in jtq:
update_role_parentage_for_instance(jt)