diff --git a/awx/api/serializers.py b/awx/api/serializers.py index 92e314fb99..c2b97efb4a 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -1244,6 +1244,12 @@ class JobTemplateSerializer(UnifiedJobTemplateSerializer, JobOptionsSerializer): res['survey_spec'] = reverse('api:job_template_survey_spec', args=(obj.pk,)) return res + def get_summary_fields(self, obj): + d = super(JobTemplateSerializer, self).get_summary_fields(obj) + if obj.survey_enabled and ('name' in obj.survey_spec and 'description' in obj.survey_spec): + d['survey'] = dict(title=obj.survey_spec['name'], description=obj.survey_spec['description']) + return d + class JobSerializer(UnifiedJobSerializer, JobOptionsSerializer): diff --git a/awx/main/models/jobs.py b/awx/main/models/jobs.py index e30485be36..6e5bdf3a28 100644 --- a/awx/main/models/jobs.py +++ b/awx/main/models/jobs.py @@ -233,8 +233,8 @@ class JobTemplate(UnifiedJobTemplate, JobOptions): errors = [] if not self.survey_enabled: return errors - if 'title' not in self.survey_spec: - errors.append("'title' missing from survey spec") + if 'name' not in self.survey_spec: + errors.append("'name' missing from survey spec") if 'description' not in self.survey_spec: errors.append("'description' missing from survey spec") for survey_element in self.survey_spec["spec"]: