set value of radio input to be org id

also don't use nil, this isn't ruby
This commit is contained in:
Leo Hemsted
2016-08-15 10:39:27 +01:00
parent fb510d2522
commit 3c0f06a36d
2 changed files with 5 additions and 4 deletions

View File

@@ -276,10 +276,10 @@ def service_set_branding_and_org(service_id):
form = ServiceBrandingOrg(branding_type=current_service.get('branding'))
# dynamically create org choices, including the null option
form.organisation.choices = [('nil', 'None')] + get_branding_as_value_and_label(organisations)
form.organisation.choices = [('None', 'None')] + get_branding_as_value_and_label(organisations)
if form.validate_on_submit():
organisation = None if form.organisation.data == 'nil' else form.organisation.data
organisation = None if form.organisation.data == 'None' else form.organisation.data
service_api_client.update_service(
service_id,
branding=form.branding_type.data,
@@ -287,8 +287,8 @@ def service_set_branding_and_org(service_id):
)
return redirect(url_for('.service_settings', service_id=service_id))
# only set form.organisation.data on GET (to select correct initial radio button)
form.organisation.data = current_service['organisation'] or 'nil'
form.organisation.data = current_service['organisation'] or 'None'
return render_template(
'views/service-settings/set-branding-and-org.html',
form=form,

View File

@@ -44,6 +44,7 @@
type="radio"
name="{{ field.name }}"
id="{{ field.name }}-{{ loop.index }}"
value="{{ value }}"
{% if checked %}checked="checked"{% endif %}
/>
{% if branding_dict.get(value, {}).get('colour') %}