mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 20:00:43 -03: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:
parent
99bd6ac38c
commit
e9a0f41152
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user