Update Notification schema to preserve template_history attribute

`Notification.template_history` relationship has been removed but
we want to keep the `template_history` key in existing notification
serializations, so we serialize it from `Notifications.template`.

This keeps the data format the same, but both `template` and
`template_history` keys will now contain data from the `TemplateHistory`
instance.
This commit is contained in:
Alexey Bezhan
2017-11-09 14:27:24 +00:00
parent a5ca66a01b
commit e73513f519

View File

@@ -450,7 +450,7 @@ class NotificationWithTemplateSchema(BaseSchema):
class NotificationWithPersonalisationSchema(NotificationWithTemplateSchema):
template_history = fields.Nested(TemplateHistorySchema,
template_history = fields.Nested(TemplateHistorySchema, attribute="template",
only=['id', 'name', 'template_type', 'content', 'subject', 'version'],
dump_only=True)