mirror of
https://github.com/ansible/awx.git
synced 2026-01-27 08:31:28 -03:30
Fix passively creation of notification templates
Passively creating notification templates on m2m endpoints was failing serializer validation due to a bug trying to look up the related object. In reality that check should only happen when the view is the NotificationTemplateDetail view.
This commit is contained in:
parent
0591647333
commit
1881af8e77
@ -2369,12 +2369,13 @@ class NotificationTemplateSerializer(BaseSerializer):
|
||||
return d
|
||||
|
||||
def validate(self, attrs):
|
||||
from awx.api.views import NotificationTemplateDetail
|
||||
notification_class = NotificationTemplate.CLASS_FOR_NOTIFICATION_TYPE[attrs['notification_type']]
|
||||
missing_fields = []
|
||||
incorrect_type_fields = []
|
||||
if 'notification_configuration' not in attrs:
|
||||
return attrs
|
||||
if self.context['view'].kwargs:
|
||||
if self.context['view'].kwargs and isinstance(self.context['view'], NotificationTemplateDetail):
|
||||
object_actual = self.context['view'].get_object()
|
||||
else:
|
||||
object_actual = None
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user