mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-21 07:21:49 -05:00
Merge pull request #2646 from anoek/2628
Better handle missing notification_type in patches to notification template
This commit is contained in:
@@ -2435,7 +2435,16 @@ class NotificationTemplateSerializer(BaseSerializer):
|
||||
|
||||
def validate(self, attrs):
|
||||
from awx.api.views import NotificationTemplateDetail
|
||||
notification_class = NotificationTemplate.CLASS_FOR_NOTIFICATION_TYPE[attrs['notification_type']]
|
||||
|
||||
notification_type = None
|
||||
if 'notification_type' in attrs:
|
||||
notification_type = attrs['notification_type']
|
||||
elif self.instance:
|
||||
notification_type = self.instance.notification_type
|
||||
if not notification_type:
|
||||
raise serializers.ValidationError('Missing required fields for Notification Configuration: notification_type')
|
||||
|
||||
notification_class = NotificationTemplate.CLASS_FOR_NOTIFICATION_TYPE[notification_type]
|
||||
missing_fields = []
|
||||
incorrect_type_fields = []
|
||||
error_list = []
|
||||
|
||||
Reference in New Issue
Block a user