From e6fb96b381aa9fd433aae82918215cdea092cdac Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Thu, 24 Oct 2024 21:26:42 -0700 Subject: [PATCH] backups: Sort list of apps in backup, restore, and schedules Fixes: #2364 Tests: - Set language to English. Go to backups -> create. List of apps is sorted alphabetically and case is ignored. Take a backup. - Click on restore for the new backup. The list of apps is again sorted alphabetically and case is ignored. - Click on schedules. List of apps is sorted and alphabetically and case is ignored. - Repeat tests with Spanish locale. Signed-off-by: Sunil Mohan Adapa Reviewed-by: Veiko Aasa --- plinth/modules/backups/forms.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plinth/modules/backups/forms.py b/plinth/modules/backups/forms.py index 30c5471b4..c00d32d64 100644 --- a/plinth/modules/backups/forms.py +++ b/plinth/modules/backups/forms.py @@ -29,14 +29,14 @@ def _get_app_choices(components): """Return a list of check box multiple choices from list of components.""" choices = [] for component in components: - name = component.app.info.name + name = str(component.app.info.name) if not component.has_data: name = gettext('{app} (No data to backup)').format( app=component.app.info.name) choices.append((component.app_id, name)) - return choices + return sorted(choices, key=lambda choice: choice[1].lower()) def _get_repository_choices():