mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
backups: Add apps selection to restore form
Signed-off-by: James Valleroy <jvalleroy@mailbox.org> Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
This commit is contained in:
1 parent
50b4bc86ae
commit
461fe21a19
3 files changed
+29
-6
No files matched your search
@@ -57,3 +57,19 @@ class ExportArchiveForm(forms.Form):
|
||||
"""Initialize the form with disk choices."""
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields['disk'].choices = get_export_locations()
|
||||
|
||||
|
||||
class RestoreForm(forms.Form):
|
||||
selected_apps = forms.MultipleChoiceField(
|
||||
label=_('Restore apps'),
|
||||
help_text=_('Apps data to restore from the backup'),
|
||||
widget=forms.CheckboxSelectMultiple)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""Initialize the form with selectable apps."""
|
||||
super().__init__(*args, **kwargs)
|
||||
apps = _list_of_all_apps_for_backup()
|
||||
# TODO: Only list apps included in the backup file.
|
||||
self.fields['selected_apps'].choices = [
|
||||
(app[0], app[1].name) for app in apps]
|
||||
self.fields['selected_apps'].initial = [app[0] for app in apps]
|
||||
Reference in new issue
Block a user