mirror of
https://github.com/GSA/notifications-api.git
synced 2026-07-25 02:19:45 -04:00
Serialise to string
This commit is contained in:
@@ -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):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user