mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-04 05:31:44 -04:00
Don’t show postage choice for international letters
International letters don’t have a choice of postage. Under the hood they are either `europe` or `rest-of-world`. So, for letters that we detect are international, this commit: - removes the radios buttons that give users the choice of postage - passes through either `europe` or `rest-of-world` to the API, depending on what address we find in the letter This will cause the API to 500 until it can accept `europe` or `rest-of-world` as postage types, but this is probably OK because it’s only our services that have international letters switched on at the moment.
This commit is contained in:
@@ -9,6 +9,7 @@ from flask_wtf import FlaskForm as Form
|
||||
from flask_wtf.file import FileAllowed
|
||||
from flask_wtf.file import FileField as FileField_wtf
|
||||
from notifications_utils.columns import Columns
|
||||
from notifications_utils.countries.data import Postage
|
||||
from notifications_utils.formatters import strip_whitespace
|
||||
from notifications_utils.postal_address import PostalAddress
|
||||
from notifications_utils.recipients import (
|
||||
@@ -850,6 +851,19 @@ class LetterTemplatePostageForm(StripWhitespaceForm):
|
||||
|
||||
|
||||
class LetterUploadPostageForm(StripWhitespaceForm):
|
||||
|
||||
def __init__(self, *args, postage_zone, **kwargs):
|
||||
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
if postage_zone != Postage.UK:
|
||||
self.postage.choices = [(postage_zone, '')]
|
||||
self.postage.data = postage_zone
|
||||
|
||||
@property
|
||||
def show_postage(self):
|
||||
return len(self.postage.choices) > 1
|
||||
|
||||
postage = RadioField(
|
||||
'Choose the postage for this letter',
|
||||
choices=[
|
||||
|
||||
Reference in New Issue
Block a user