From ae356fc7417ba1f3a10b01e46cc374dc0e2a35f2 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Wed, 16 Nov 2016 17:59:47 +0000 Subject: [PATCH] Use PDF link renderer to preview letters Depends on and implements: - [x] https://github.com/alphagov/notifications-utils/pull/84 - [ ] https://github.com/alphagov/notifications-utils/pull/86 --- app/main/views/send.py | 1 + app/utils.py | 4 ++-- requirements.txt | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/main/views/send.py b/app/main/views/send.py index 281ce0d46..fc0c8e5e1 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -20,6 +20,7 @@ from flask_login import login_required, current_user from notifications_utils.columns import Columns from notifications_utils.template import Template from notifications_utils.recipients import RecipientCSV, first_column_headings, validate_and_format_phone_number +from notifications_utils.renderers import EmailPreview, SMSPreview, LetterPDFLink from app.main import main from app.main.forms import CsvUploadForm, ChooseTimeForm, get_next_days_until, get_furthest_possible_scheduled_time diff --git a/app/utils.py b/app/utils.py index 367d09cfc..bba748c2b 100644 --- a/app/utils.py +++ b/app/utils.py @@ -8,7 +8,7 @@ import unicodedata from flask import (abort, current_app, session, request, redirect, url_for) from flask_login import current_user -from notifications_utils.renderers import SMSPreview, EmailPreview, LetterPreview +from notifications_utils.renderers import SMSPreview, EmailPreview, LetterPDFLink import pyexcel import pyexcel.ext.io @@ -233,5 +233,5 @@ def get_renderer(template_type, service, show_recipient, expand_emails=False): sender=service['sms_sender'], show_recipient=show_recipient ), - 'letter': LetterPreview(), + 'letter': LetterPDFLink(service['id']), }[template_type] diff --git a/requirements.txt b/requirements.txt index 19c26785b..897f946fb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,4 +22,4 @@ wand==0.4.4 git+https://github.com/alphagov/notifications-python-client.git@3.0.1#egg=notifications-python-client==3.0.1 -git+https://github.com/alphagov/notifications-utils.git@11.0.2#egg=notifications-utils==11.0.2 +git+https://github.com/alphagov/notifications-utils.git@11.1.0#egg=notifications-utils==11.1.0