Add survey bits to summary fields on job templates.... change "title" to

"name" on survey metadata.
This commit is contained in:
Matthew Jones
2014-09-22 11:10:33 -04:00
parent 36ab9d98e0
commit 259e48df3e
2 changed files with 8 additions and 2 deletions

View File

@@ -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):