diff options
Diffstat (limited to 'ogcp/views.py')
-rw-r--r-- | ogcp/views.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index 2ca2681..a09e33e 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -1596,7 +1596,8 @@ def action_room_add(): payload = {"center": int(form.center.data), "name": form.name.data, "netmask": form.netmask.data, - "gateway": form.gateway.data} + "gateway": form.gateway.data, + "folder_id": int(form.folder_id.data)} r = server.post('/room/add', payload) if r.status_code != requests.codes.ok: flash(_('Server replied with error code when adding the room'), category='error') @@ -1606,7 +1607,7 @@ def action_room_add(): else: params = request.args.to_dict() if not params.get('scope-center'): - flash(_('Please, select one center'), category='error') + flash(_('Please, select a center or a folder'), category='error') return redirect(url_for('scopes')) server = get_server_from_ip_port(params['scope-server']) r = server.get('/scopes') @@ -1617,6 +1618,12 @@ def action_room_add(): form.center.choices = selected_center form.center.render_kw = {'readonly': True} form.server.data = params['scope-server'] + + if params.get('folder'): + form.folder_id.data = params['folder'] + else: + form.folder_id.data = 0 + scopes, clients = get_scopes() return render_template('actions/add_room.html', form=form, scopes=scopes) |