From a3ca7867580cfc8b34ec1bf57912afa9dbc64d6f Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Mon, 31 Mar 2014 10:25:19 -0400 Subject: [PATCH] Fix some import errors and filter errors when updating unified_jobs with schedule information --- awx/main/models/unified_jobs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/awx/main/models/unified_jobs.py b/awx/main/models/unified_jobs.py index 2783315ab1..2a78db1719 100644 --- a/awx/main/models/unified_jobs.py +++ b/awx/main/models/unified_jobs.py @@ -31,6 +31,7 @@ from djcelery.models import TaskMeta # AWX from awx.main.models.base import * +from awx.main.models.schedules import Schedule from awx.main.utils import decrypt_field, get_type_for_model __all__ = ['UnifiedJobTemplate', 'UnifiedJob'] @@ -175,7 +176,7 @@ class UnifiedJobTemplate(PolymorphicModel, CommonModelNameNotUnique): return self.last_job_run def update_computed_fields(self): - related_schedules = Schedule.objects.get(enabled=True, unified_job_template=self, next_run__isnull=False).order_by('-next_run') + related_schedules = Schedule.objects.filter(enabled=True, unified_job_template=self, next_run__isnull=False).order_by('-next_run') if related_schedules.exists(): self.next_schedule = related_schedules[0] self.next_job_run = related_schedules[0].next_run