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

Merge pull request #1687 from AlanCoding/cannot_find_org

Avoid DB action in signal, confusing logs
This commit is contained in:
Alan Rominger 2018-05-04 10:42:55 -04:00 committed by GitHub
commit 0fae43fc70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)