From e9a0f41152c052c41aae29ab28d013d8d5e09510 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Wed, 13 Jul 2016 10:45:17 -0400 Subject: [PATCH] Fix an ommitted fields 500 error If organization or notification_template is omitted entirely from the POST for a new item then a 500 error would be raised --- awx/api/serializers.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/awx/api/serializers.py b/awx/api/serializers.py index dbe74f9272..3680b1819c 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -2427,10 +2427,14 @@ class NotificationTemplateSerializer(BaseSerializer): notification_type = attrs['notification_type'] elif self.instance: notification_type = self.instance.notification_type + else: + notification_type = None if 'organization' in attrs: organization = attrs['organization'] elif self.instance: organization = self.instance.organization + else: + organization = None if not notification_type: raise serializers.ValidationError('Missing required fields for Notification Configuration: notification_type') if not organization: