Updated the schema to return reply_to - which is the id and reply_to_text which is the contact_block

This commit is contained in:
Rebecca Law
2018-02-14 11:20:09 +00:00
parent c833a76070
commit 94162bc1bf
2 changed files with 7 additions and 2 deletions

View File

@@ -346,7 +346,8 @@ class TemplateSchema(BaseTemplateSchema):
class TemplateHistorySchema(BaseSchema):
reply_to_text = fields.Method("get_reply_to", allow_none=True)
reply_to = fields.Method("get_reply_to", allow_none=True)
reply_to_text = fields.Method("get_reply_to_text", allow_none=True)
created_by = fields.Nested(UserSchema, only=['id', 'name', 'email_address'], dump_only=True)
created_at = field_for(models.Template, 'created_at', format='%Y-%m-%d %H:%M:%S.%f')
@@ -354,6 +355,9 @@ class TemplateHistorySchema(BaseSchema):
def get_reply_to(self, template):
return template.reply_to
def get_reply_to_text(self, template):
return template.get_reply_to_text()
class Meta:
model = models.TemplateHistory