From e4d860e3dc8531d8b65252af48beb148275d33f2 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Fri, 14 Feb 2014 09:46:10 -0500 Subject: [PATCH] Fix issue AC-977 by including job_template in summary fields for job activity stream events --- awx/api/serializers.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/awx/api/serializers.py b/awx/api/serializers.py index 7ccf380fb5..d88a3e2a3d 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -1207,7 +1207,18 @@ class ActivityStreamSerializer(BaseSerializer): allm2m = getattr(obj, fk).all() if allm2m.count() > 0: summary_fields[fk] = [] + summary_fields['job_template'] = [] for thisItem in allm2m: + if fk == 'job': + job_template_item = {} + job_template_fields = SUMMARIZABLE_FK_FIELDS['job_template'] + job_template = getattr(thisItem, 'job_template', None) + if job_template is not None: + for field in job_template_fields: + fval = getattr(job_template, field, None) + if fval is not None: + job_template_item[field] = fval + summary_fields['job_template'].append(job_template_item) thisItemDict = {} if 'id' not in related_fields: related_fields = related_fields + ('id',)