def service_switch_live(service_id): form = ServiceOnOffSettingForm( name="Make service live", enabled=ServiceOnOffSettingForm.enabled_from_boolean(not current_service['restricted']) ) if form.validate_on_submit(): service_api_client.update_status(service_id, live=form.enabled.data) return redirect(url_for('.service_settings', service_id=service_id)) return render_template( 'views/service-settings/set-service-setting.html', title="Make service live", form=form, )
def service_switch_count_as_live(service_id): form = ServiceOnOffSettingForm( name="Count in list of live services", enabled=ServiceOnOffSettingForm.enabled_from_boolean(current_service['count_as_live']), ) if form.validate_on_submit(): service_api_client.update_service_with_properties( service_id, {"count_as_live": form.enabled.data} ) return redirect(url_for('.service_settings', service_id=service_id)) return render_template( 'views/service-settings/set-service-setting.html', title="Count in list of live services", form=form, )