diff --git a/app/schemas.py b/app/schemas.py index 10cf6e90f..91ea0cbaf 100644 --- a/app/schemas.py +++ b/app/schemas.py @@ -2,6 +2,7 @@ from datetime import ( datetime, date, timedelta) +from uuid import UUID from flask_marshmallow.fields import fields from marshmallow import ( post_load, @@ -334,6 +335,16 @@ class TemplateSchema(BaseTemplateSchema): if not subject or subject.strip() == '': raise ValidationError('Invalid template subject', 'subject') + @post_dump() + def __post_dump(self, data): + for field in ( + 'service', + 'created_by', + 'template_redacted', + ): + if isinstance(data[field], UUID): + data[field] = str(data[field]) + class TemplateHistorySchema(BaseSchema):