mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-14 23:08:07 -04:00
Merge pull request #3057 from alphagov/new_org_types_part_1
Introduce new org types
This commit is contained in:
@@ -4,7 +4,7 @@ from notifications_python_client.errors import HTTPError
|
||||
|
||||
from app import billing_api_client, service_api_client
|
||||
from app.main import main
|
||||
from app.main.forms import CreateServiceForm
|
||||
from app.main.forms import CreateNhsServiceForm, CreateServiceForm
|
||||
from app.utils import email_safe, user_is_gov_user, user_is_logged_in
|
||||
|
||||
|
||||
@@ -47,9 +47,14 @@ def _create_example_template(service_id):
|
||||
@user_is_logged_in
|
||||
@user_is_gov_user
|
||||
def add_service():
|
||||
form = CreateServiceForm(
|
||||
organisation_type=current_user.default_organisation_type
|
||||
)
|
||||
default_organisation_type = current_user.default_organisation_type
|
||||
if default_organisation_type == 'nhs':
|
||||
form = CreateNhsServiceForm()
|
||||
default_organisation_type = None
|
||||
else:
|
||||
form = CreateServiceForm(
|
||||
organisation_type=default_organisation_type
|
||||
)
|
||||
heading = 'About your service'
|
||||
|
||||
if form.validate_on_submit():
|
||||
@@ -58,7 +63,7 @@ def add_service():
|
||||
|
||||
service_id, error = _create_service(
|
||||
service_name,
|
||||
current_user.default_organisation_type or form.organisation_type.data,
|
||||
default_organisation_type or form.organisation_type.data,
|
||||
email_from,
|
||||
form,
|
||||
)
|
||||
@@ -72,11 +77,12 @@ def add_service():
|
||||
return redirect(url_for(
|
||||
'main.start_tour',
|
||||
service_id=service_id,
|
||||
template_id=example_sms_template['data']['id'],
|
||||
template_id=example_sms_template['data']['id']
|
||||
))
|
||||
else:
|
||||
return render_template(
|
||||
'views/add-service.html',
|
||||
form=form,
|
||||
heading=heading
|
||||
heading=heading,
|
||||
default_organisation_type=default_organisation_type,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user