1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +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 pre-save organization, so we can later determine if the organization
field is dirty. field is dirty.
''' '''
instance.__original_org = instance.organization instance.__original_org_id = instance.organization_id
def save_related_job_templates(sender, instance, **kwargs): 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): if sender not in (Project, Inventory):
raise ValueError('This signal callback is only intended for use with Project or 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}) jtq = JobTemplate.objects.filter(**{sender.__name__.lower(): instance})
for jt in jtq: for jt in jtq:
update_role_parentage_for_instance(jt) update_role_parentage_for_instance(jt)