copy organization when copying a WFJT

This commit is contained in:
AlanCoding
2016-11-19 11:33:26 -05:00
parent 31a95e5c04
commit 4a992e531a
4 changed files with 16 additions and 7 deletions

View File

@@ -79,10 +79,6 @@ class SurveyJobTemplateMixin(models.Model):
default={},
)
@classmethod
def _get_unified_jt_copy_names(cls):
return cls._get_unified_job_field_names() + ['survey_spec', 'survey_enabled']
def survey_password_variables(self):
vars = []
if self.survey_enabled and 'spec' in self.survey_spec:

View File

@@ -357,6 +357,10 @@ class UnifiedJobTemplate(PolymorphicModel, CommonModelNameNotUnique, Notificatio
dest_field.add(*list(src_field_value.all().values_list('id', flat=True)))
return unified_job
@classmethod
def _get_unified_jt_copy_names(cls):
return cls._get_unified_job_field_names()
def copy_unified_jt(self):
'''
Create a copy of this unified job template.

View File

@@ -362,7 +362,13 @@ class WorkflowJobTemplate(UnifiedJobTemplate, WorkflowJobOptions, SurveyJobTempl
@classmethod
def _get_unified_job_field_names(cls):
return ['name', 'description', 'extra_vars', 'labels', 'survey_passwords', 'schedule', 'launch_type']
return ['name', 'description', 'extra_vars', 'labels', 'survey_passwords',
'schedule', 'launch_type']
@classmethod
def _get_unified_jt_copy_names(cls):
return (super(WorkflowJobTemplate, cls)._get_unified_jt_copy_names() +
['survey_spec', 'survey_enabled', 'organization'])
def get_absolute_url(self):
return reverse('api:workflow_job_template_detail', args=(self.pk,))