From b0a995beb2a206370610eaa9664852d98d3987fb Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 24 Mar 2017 11:51:47 +0000 Subject: [PATCH] Handle lists as CSV field values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Brings in: - [ ] https://github.com/alphagov/notifications-utils/pull/128 This means that `RecipientCSV` will sometimes return the value of a cell in a spreadsheet as a `list`, not a `string`. So we need to handle that, rather than putting a Python representation (`['one', 'two', 'three']`) on the page. This commit handles it by putting a bulleted list on the page instead. This breaks our model of showing the spreadsheet as it appears in Excel or whatever, because we’re showing the aggregation of the columns into a list. However: - this is the easier thing to do for now - it might actually be more usable because it keeps the table narrower --- app/templates/components/table.html | 10 +++++++++- requirements.txt | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/templates/components/table.html b/app/templates/components/table.html index 393e6282e..86e62ce63 100644 --- a/app/templates/components/table.html +++ b/app/templates/components/table.html @@ -81,7 +81,15 @@ {% macro text_field(text, status='') -%} {% call field(status=status) %} - {{ text }} + {% if text is iterable and text is not string %} + + {% else %} + {{ text }} + {% endif %} {% endcall %} {%- endmacro %} diff --git a/requirements.txt b/requirements.txt index 006050096..2ded06139 100644 --- a/requirements.txt +++ b/requirements.txt @@ -31,4 +31,4 @@ notifications-python-client>=3.1,<3.2 awscli>=1.11,<1.12 awscli-cwlogs>=1.4,<1.5 -git+https://github.com/alphagov/notifications-utils.git@13.10.0#egg=notifications-utils==13.10.0 +git+https://github.com/alphagov/notifications-utils.git@14.0.0#egg=notifications-utils==14.0.0