mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 01:21:21 +03:00
Fix some import errors and filter errors when updating unified_jobs with
schedule information
This commit is contained in:
parent
d6942e0dbe
commit
a3ca786758
@ -31,6 +31,7 @@ from djcelery.models import TaskMeta
|
|||||||
|
|
||||||
# AWX
|
# AWX
|
||||||
from awx.main.models.base import *
|
from awx.main.models.base import *
|
||||||
|
from awx.main.models.schedules import Schedule
|
||||||
from awx.main.utils import decrypt_field, get_type_for_model
|
from awx.main.utils import decrypt_field, get_type_for_model
|
||||||
|
|
||||||
__all__ = ['UnifiedJobTemplate', 'UnifiedJob']
|
__all__ = ['UnifiedJobTemplate', 'UnifiedJob']
|
||||||
@ -175,7 +176,7 @@ class UnifiedJobTemplate(PolymorphicModel, CommonModelNameNotUnique):
|
|||||||
return self.last_job_run
|
return self.last_job_run
|
||||||
|
|
||||||
def update_computed_fields(self):
|
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():
|
if related_schedules.exists():
|
||||||
self.next_schedule = related_schedules[0]
|
self.next_schedule = related_schedules[0]
|
||||||
self.next_job_run = related_schedules[0].next_run
|
self.next_job_run = related_schedules[0].next_run
|
||||||
|
Loading…
Reference in New Issue
Block a user