Add postal address row errors

Context:
- postal addresses can be made from any of the 7 address lines now, and
  the postcode can be in any one of the 7
- we can put errors across a whole row now, not just on individual cells

This commit put errors to do with the postal address as a whole across
the whole row now, rather than tying them to any one cell.
This commit is contained in:
Chris Hill-Scott
2020-04-15 13:31:14 +01:00
parent f5649d72c9
commit 832445774b
3 changed files with 62 additions and 0 deletions

View File

@@ -711,6 +711,8 @@ def _check_messages(service_id, template_id, upload_id, preview_row, letters_as_
),
letter_too_long=is_letter_too_long(page_count),
letter_max_pages=LETTER_MAX_PAGE_COUNT,
letter_min_address_lines=PostalAddress.MIN_LINES,
letter_max_address_lines=PostalAddress.MAX_LINES,
page_count=page_count
)

View File

@@ -80,6 +80,12 @@
No content for this message
{% elif item.message_too_long %}
Message is too long
{% elif not item.as_postal_address.has_enough_lines %}
Address must be at least {{ letter_min_address_lines }} lines long
{% elif item.as_postal_address.has_too_many_lines %}
Address must be no more than {{ letter_max_address_lines }} lines long
{% elif not item.as_postal_address.postcode %}
Last line of the address must be a real UK postcode
{% endif %}
</span>
{% endcall %}