Fix the schema for reply_to and added reply_to_text.

This commit is contained in:
Rebecca Law
2018-01-04 15:56:58 +00:00
parent d9668974ae
commit 0c5625fb8b
2 changed files with 8 additions and 6 deletions

View File

@@ -311,15 +311,15 @@ class NotificationModelSchema(BaseSchema):
class BaseTemplateSchema(BaseSchema):
reply_to = fields.Method("get_reply_to", allow_none=True)
reply_to_text = fields.Method("get_reply_to_text", allow_none=True)
def get_reply_to(self, template):
if template.template_type == 'letter':
text = template.get_reply_to_text()
return text
return template.reply_to
def get_reply_to_text(self, template):
return template.get_reply_to_text()
class Meta:
model = models.Template
exclude = ("service_id", "jobs", "service_letter_contact_id")