Serialise to string

This commit is contained in:
Chris Hill-Scott
2020-06-12 15:17:14 +01:00
parent 04ae715a3b
commit 6c27b80060

View File

@@ -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):