Only show contact lists relevant to template

You can’t send an email message template to a list of phone numbers. So
we shouldn’t show you the lists of phone numbers when you’ve chosen an
email template.
This commit is contained in:
Chris Hill-Scott
2020-03-16 09:41:42 +00:00
parent b598af1eca
commit 6c2021aeb2
5 changed files with 128 additions and 43 deletions

View File

@@ -125,5 +125,13 @@ class ContactList(JSONModel):
class ContactLists(ModelList):
client_method = contact_list_api_client.get_contact_lists
model = ContactList
def __init__(self, service_id, template_type=None):
super().__init__(service_id)
self.items = [
item for item in self.items
if template_type in {item['template_type'], None}
]