Add a selectField to edit and create templates that is only visible for platform admins that makes the template a priority template.

There is a check that the template can not be created as priority if the user is not a platform admin.
There is a check that the template can not change the `priority` unless they are a platform admin.
This commit is contained in:
Rebecca Law
2017-01-18 15:11:34 +00:00
parent dfc751ef02
commit 3dfb3806d2
8 changed files with 210 additions and 45 deletions

View File

@@ -116,7 +116,7 @@ class ServiceAPIClient(NotifyAdminAPIClient):
data = _attach_current_user({})
return self.delete(endpoint, data)
def create_service_template(self, name, type_, content, service_id, subject=None):
def create_service_template(self, name, type_, content, service_id, subject=None, process_type='normal'):
"""
Create a service template.
"""
@@ -124,7 +124,8 @@ class ServiceAPIClient(NotifyAdminAPIClient):
"name": name,
"template_type": type_,
"content": content,
"service": service_id
"service": service_id,
"process_type": process_type
}
if subject:
data.update({
@@ -132,9 +133,10 @@ class ServiceAPIClient(NotifyAdminAPIClient):
})
data = _attach_current_user(data)
endpoint = "/service/{0}/template".format(service_id)
print('got here in create_service_template')
return self.post(endpoint, data)
def update_service_template(self, id_, name, type_, content, service_id, subject=None):
def update_service_template(self, id_, name, type_, content, service_id, subject=None, process_type=None):
"""
Update a service template.
"""
@@ -149,6 +151,10 @@ class ServiceAPIClient(NotifyAdminAPIClient):
data.update({
'subject': subject
})
if process_type:
data.update({
'process_type': process_type
})
data = _attach_current_user(data)
endpoint = "/service/{0}/template/{1}".format(service_id, id_)
return self.post(endpoint, data)