Make phone numbers human readable

- in the example table on the ‘send’ page
- in the example CSV files

Implements: https://github.com/alphagov/notifications-utils/pull/18
This commit is contained in:
Chris Hill-Scott
2016-04-06 09:22:41 +01:00
parent bcad27ed83
commit 2abc336a0c
3 changed files with 7 additions and 5 deletions

View File

@@ -18,7 +18,7 @@ from flask import (
from flask_login import login_required, current_user from flask_login import login_required, current_user
from utils.template import Template from utils.template import Template
from utils.recipients import RecipientCSV, first_column_heading from utils.recipients import RecipientCSV, first_column_heading, validate_and_format_phone_number
from app.main import main from app.main import main
from app.main.forms import CsvUploadForm from app.main.forms import CsvUploadForm
@@ -55,7 +55,9 @@ def get_example_csv_rows(template, number_of_rows=2):
[ [
{ {
'email': current_user.email_address, 'email': current_user.email_address,
'sms': current_user.mobile_number 'sms': validate_and_format_phone_number(
current_user.mobile_number, human_readable=True
)
}[template.template_type] }[template.template_type]
] + [ ] + [
"{} {}".format(header, i) for header in template.placeholders "{} {}".format(header, i) for header in template.placeholders

View File

@@ -14,4 +14,4 @@ Pygments==2.0.2
git+https://github.com/alphagov/notifications-python-client.git@0.3.1#egg=notifications-python-client==0.3.1 git+https://github.com/alphagov/notifications-python-client.git@0.3.1#egg=notifications-python-client==0.3.1
git+https://github.com/alphagov/notifications-utils.git@3.2.1#egg=notifications-utils==3.2.1 git+https://github.com/alphagov/notifications-utils.git@3.3.0#egg=notifications-utils==3.3.0