From a41ad5eec6cefe540cbb5c4a5454c0c4ae24bf1c Mon Sep 17 00:00:00 2001 From: Javier Hernandez Date: Thu, 1 Feb 2024 11:39:20 +0100 Subject: views: Fix client-info form not fully read-only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix some fields (boot-mode and oglive) in client-info form that, despite being flagged as read-only, allowed the user to change values. --- ogcp/views.py | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/ogcp/views.py b/ogcp/views.py index dd16e79..c2be721 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -994,7 +994,7 @@ def action_client_info(): form.mac.render_kw = {'readonly': True} form.serial_number.data = db_client['serial_number'] form.serial_number.render_kw = {'readonly': True} - form.livedir.data = db_client['livedir'] + form.livedir.choices = [(db_client['livedir'], db_client['livedir'])] form.livedir.render_kw = {'readonly': True} form.remote.data = db_client['remote'] form.remote.render_kw = {'readonly': True} @@ -1011,29 +1011,9 @@ def action_client_info(): form.repo.render_kw = {'readonly': True} form.room.data = db_client['room'] form.room.render_kw = {'readonly': True} - form.boot.data = db_client['boot'] + form.boot.choices = [(db_client['boot'], db_client['boot'])] form.boot.render_kw = {'readonly': True} - r = server.get('/oglive/list') - if not r: - return ogserver_down('commands') - if r.status_code != requests.codes.ok: - return ogserver_error('commands') - - available_oglives = r.json()['oglive'] - for oglive in available_oglives: - choice = (oglive.get('directory'), oglive.get('directory')) - form.livedir.choices.append(choice) - - r = server.get('/mode') - if not r: - return ogserver_down('commands') - if r.status_code != requests.codes.ok: - return ogserver_error('commands') - - available_modes = [(mode, mode) for mode in r.json()['modes']] - form.boot.choices = list(available_modes) - r = server.get('/scopes') if not r: return ogserver_down('commands') -- cgit v1.2.3-18-g5258