diff options
Diffstat (limited to 'ogcp')
-rw-r--r-- | ogcp/views.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index 2a89d01..6b8607e 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -834,6 +834,12 @@ def get_images_from_repo(server, repo_id): res.append(image) return res +def get_image_key(image): + return image['name'] + +def sort_images(images): + images.sort(key=get_image_key, reverse=False) + def get_clients_repo(server, ips): repo_id=None for ip in ips: @@ -984,6 +990,8 @@ def action_image_restore(): except ServerErrorCode: return ogserver_error('commands') + sort_images(images) + for image in images: form.image.choices.append((image['id'], image['name'])) @@ -2431,6 +2439,8 @@ def action_image_update(): except ServerErrorCode: return ogserver_error('commands') + sort_images(images) + for image in images: form.image.choices.append((image['id'], image['name'])) @@ -2891,6 +2901,9 @@ def get_images_grouped_by_repos(): except ServerErrorCode: continue repos={} + + sort_images(images) + for image in images: repo_id=image['repo_id'] repo_data={} |