Return rendered HTML when previewing a template

If you’re trying to show what a Notify email will look like in your
caseworking system all the API gives you at the moment is raw markdown
(with the placeholders replaced).

This isn’t that useful if your caseworkers have no idea what markdown
is. If we also give teams the HTML then they can embed this in their
systems, and the people using those systems will be able to see how
headings, bulleted lists, etc. look.
This commit is contained in:
Chris Hill-Scott
2019-02-07 11:40:02 +00:00
parent a0e33f0d75
commit f185dbecbe
3 changed files with 61 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
from app.models import SMS_TYPE, TEMPLATE_TYPES
from app.schema_validation.definitions import uuid, personalisation
from app.utils import get_html_email_body_from_template
get_template_by_id_request = {
@@ -79,6 +80,7 @@ def create_post_template_preview_response(template, template_object):
"type": template.template_type,
"version": template.version,
"body": str(template_object),
"html": get_html_email_body_from_template(template_object),
"subject": subject,
"postage": template.postage
}