From 8ddc1c61ef19f7674e6e4b5d1188d9c6294384c7 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Wed, 31 Jan 2018 15:18:11 -0500 Subject: [PATCH] add related links to the inventory and project for a schedule see: https://github.com/ansible/awx/issues/276 --- awx/api/serializers.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/awx/api/serializers.py b/awx/api/serializers.py index d1cdcd8a90..0b867ad7b6 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -3946,6 +3946,12 @@ class ScheduleSerializer(LaunchConfigurationBaseSerializer, SchedulePreviewSeria )) if obj.unified_job_template: res['unified_job_template'] = obj.unified_job_template.get_absolute_url(self.context.get('request')) + if obj.unified_job_template.project: + res['project'] = obj.unified_job_template.project.get_absolute_url(self.context.get('request')) + if obj.inventory: + res['inventory'] = obj.inventory.get_absolute_url(self.context.get('request')) + elif obj.unified_job_template and obj.unified_job_template.inventory: + res['inventory'] = obj.unified_job_template.inventory.get_absolute_url(self.context.get('request')) return res def validate_unified_job_template(self, value):