Update standalone schedule name uniqueness combining it with unified job template.

Signed-off-by: Vismay Golwala <vgolwala@redhat.com>
This commit is contained in:
Vismay Golwala
2019-02-07 15:26:56 -05:00
parent 295afa805c
commit 4af54517d2
3 changed files with 74 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ from django.utils.translation import ugettext_lazy as _
# AWX
from awx.api.versioning import reverse
from awx.main.models.base import CommonModel
from awx.main.models.base import PrimordialModel
from awx.main.models.jobs import LaunchTimeConfig
from awx.main.utils import ignore_inventory_computed_fields
from awx.main.consumers import emit_channel_notification
@@ -61,11 +61,12 @@ class ScheduleManager(ScheduleFilterMethods, models.Manager):
return ScheduleQuerySet(self.model, using=self._db)
class Schedule(CommonModel, LaunchTimeConfig):
class Schedule(PrimordialModel, LaunchTimeConfig):
class Meta:
app_label = 'main'
ordering = ['-next_run']
unique_together = ('unified_job_template', 'name')
objects = ScheduleManager()
@@ -74,6 +75,9 @@ class Schedule(CommonModel, LaunchTimeConfig):
related_name='schedules',
on_delete=models.CASCADE,
)
name = models.CharField(
max_length=512,
)
enabled = models.BooleanField(
default=True,
help_text=_("Enables processing of this schedule.")