backups: List supported and installed apps when creating

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
This commit is contained in:
James Valleroy 2018-08-21 18:13:37 -04:00 committed by Joseph Nuthalapati
parent 292597d894
commit db2c828220
No known key found for this signature in database
GPG Key ID: 5398F00A2FA43C35

View File

@ -23,6 +23,7 @@ from django.core import validators
from django.utils.translation import ugettext_lazy as _
from . import get_export_locations
from .backups import _list_of_all_apps_for_backup
class CreateArchiveForm(forms.Form):
@ -32,10 +33,22 @@ class CreateArchiveForm(forms.Form):
validators.RegexValidator(r'^[^/]+$', _('Invalid archive name'))
])
selected_apps = forms.MultipleChoiceField(
label=_('Included apps'),
help_text=_('Apps to include in the backup'),
widget=forms.CheckboxSelectMultiple)
path = forms.CharField(label=_('Path'), strip=True, help_text=_(
'Disk path to a folder on this server that will be archived into '
'backup repository.'))
def __init__(self, *args, **kwargs):
"""Initialize the form with selectable apps."""
super().__init__(*args, **kwargs)
apps = _list_of_all_apps_for_backup()
self.fields['selected_apps'].choices = [
(app[0], app[1].name) for app in apps]
class ExportArchiveForm(forms.Form):
disk = forms.ChoiceField(