From e73513f51994b97db1b390ef10c663217834d26b Mon Sep 17 00:00:00 2001 From: Alexey Bezhan Date: Thu, 9 Nov 2017 14:27:24 +0000 Subject: [PATCH] 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. --- app/schemas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/schemas.py b/app/schemas.py index e689bf83f..13bf10120 100644 --- a/app/schemas.py +++ b/app/schemas.py @@ -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)