Redirect to new organisation after creation

The thing you want to do after creating an org is probably set some
domains or default branding, so let’s take you to the page where you can
do that.
This commit is contained in:
Chris Hill-Scott
2019-07-02 10:09:08 +01:00
parent 44a78d3cd1
commit 08bc893ddf
2 changed files with 12 additions and 4 deletions

View File

@@ -54,8 +54,10 @@ def add_organisation():
form = NewOrganisationForm()
if form.validate_on_submit():
Organisation.create_from_form(form)
return redirect(url_for('.organisations'))
return redirect(url_for(
'.organisation_settings',
org_id=Organisation.create_from_form(form).id,
))
return render_template(
'views/organisations/add-organisation.html',

View File

@@ -103,7 +103,8 @@ def test_create_new_organisation(
mocker,
):
mock_create_organisation = mocker.patch(
'app.organisations_client.create_organisation'
'app.organisations_client.create_organisation',
return_value=organisation_json(ORGANISATION_ID),
)
client_request.login(platform_admin_user)
@@ -113,7 +114,12 @@ def test_create_new_organisation(
'name': 'new name',
'organisation_type': 'local',
'crown_status': 'non-crown',
}
},
_expected_redirect=url_for(
'main.organisation_settings',
org_id=ORGANISATION_ID,
_external=True,
),
)
mock_create_organisation.assert_called_once_with(