Filter mail addresses by domain (if any).
This commit is contained in:
parent
16a59792a0
commit
9cbeb325bb
|
@ -153,9 +153,14 @@ class MailView(ServiceListView):
|
||||||
|
|
||||||
return mailboxes[0]['id']
|
return mailboxes[0]['id']
|
||||||
|
|
||||||
# group addresses with the same mailbox
|
# retrieve mails applying filters (if any)
|
||||||
|
queryfilter = self.get_queryfilter()
|
||||||
raw_data = self.orchestra.retrieve_service_list(
|
raw_data = self.orchestra.retrieve_service_list(
|
||||||
self.service_class.api_name)
|
self.service_class.api_name,
|
||||||
|
querystring=queryfilter,
|
||||||
|
)
|
||||||
|
|
||||||
|
# group addresses with the same mailbox
|
||||||
addresses = []
|
addresses = []
|
||||||
for key, group in groupby(raw_data, retrieve_mailbox):
|
for key, group in groupby(raw_data, retrieve_mailbox):
|
||||||
aliases = []
|
aliases = []
|
||||||
|
@ -169,6 +174,14 @@ class MailView(ServiceListView):
|
||||||
|
|
||||||
return addresses
|
return addresses
|
||||||
|
|
||||||
|
def get_queryfilter(self):
|
||||||
|
"""Retrieve query params (if any) to filter queryset"""
|
||||||
|
domain_id = self.request.GET.get('domain')
|
||||||
|
if domain_id is None:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
return "domain={}".format(domain_id)
|
||||||
|
|
||||||
|
|
||||||
class MailingListsView(ServiceListView):
|
class MailingListsView(ServiceListView):
|
||||||
service_class = MailinglistService
|
service_class = MailinglistService
|
||||||
|
|
Loading…
Reference in New Issue