diff options
author | Javier Hernandez <jhernandez@soleta.eu> | 2023-11-29 12:27:19 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2023-11-29 13:20:07 +0100 |
commit | 3b932fc6a884a3fda8b7a5fdddac85aef8e21a30 (patch) | |
tree | 5fae94e7669c6f93c917619d1444134677b306a9 | |
parent | 4a70bc174c6cf73bf21f0bd72ac54c4a6da4d0bb (diff) |
views: fix repository list in update client
Make the repository list's first element be the current repo in use.
This is needed because, otherwise, an update could inadvertently
change the repo.
Remove a print statement that is no longer needed
-rw-r--r-- | ogcp/views.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index 53487a1..fa458e3 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -897,7 +897,6 @@ def action_client_update(): db_client = r.json() form.server.data = "{0}:{1}".format(server.ip, server.port) - print("server ip:", form.server.data) form.ip.data = db_client['ip'] form.ip.render_kw = {'readonly': True} form.name.data = db_client['name'] @@ -907,7 +906,6 @@ def action_client_update(): form.remote.data = db_client['remote'] form.maintenance.data = db_client['maintenance'] form.netiface.data = db_client['netiface'] - form.repo.data = db_client['repo_id'] form.boot.render_kw = {'readonly': True} r = server.get('/scopes') @@ -919,7 +917,10 @@ def action_client_update(): form.room.render_kw = {'readonly': True} repositories = get_repositories(server) - form.repo.choices = [(repo["id"], repo["name"]) for repo in repositories] + form.repo.choices = [(repo["id"], repo["name"]) for repo in repositories + if db_client['repo_id'] == repo["id"]] + form.repo.choices.extend([(repo["id"], repo["name"]) for repo in repositories + if db_client['repo_id'] != repo["id"]]) form.create.render_kw = {"formaction": url_for('action_client_update')} return render_template('actions/client_details.html', form=form, |