mirror of
https://github.com/ansible/awx.git
synced 2026-03-08 21:19:26 -02:30
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
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user