Fix up organization default exposed by unit test

This commit is contained in:
Matthew Jones 2016-07-06 16:35:59 -04:00
parent 51b959406a
commit 3e0ed4c1a1

View File

@ -2427,9 +2427,13 @@ class NotificationTemplateSerializer(BaseSerializer):
notification_type = attrs['notification_type']
elif self.instance:
notification_type = self.instance.notification_type
if 'organization' in attrs:
organization = attrs['organization']
elif self.instance:
organization = self.instance.organization
if not notification_type:
raise serializers.ValidationError('Missing required fields for Notification Configuration: notification_type')
if 'organization' not in attrs:
if not organization:
raise serializers.ValidationError("Missing 'organization' from required fields")
notification_class = NotificationTemplate.CLASS_FOR_NOTIFICATION_TYPE[notification_type]