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 <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Sunil Mohan Adapa 2024-10-24 21:26:42 -07:00 committed by Veiko Aasa
parent 15e9c6cad9
commit e6fb96b381
No known key found for this signature in database
GPG Key ID: 478539CAE680674E

View File

@ -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():