From 616af37407435b3b9550394dc7013c4e18123cc5 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Sat, 25 Aug 2018 20:47:57 -0400 Subject: [PATCH] backups: Disable create archive when no supported apps are installed Signed-off-by: James Valleroy Reviewed-by: Joseph Nuthalapati --- plinth/modules/backups/templates/backups.html | 10 ++++++++++ plinth/modules/backups/views.py | 3 +++ 2 files changed, 13 insertions(+) diff --git a/plinth/modules/backups/templates/backups.html b/plinth/modules/backups/templates/backups.html index f42e4b74b..f37636334 100644 --- a/plinth/modules/backups/templates/backups.html +++ b/plinth/modules/backups/templates/backups.html @@ -39,6 +39,7 @@

{{ paragraph|safe }}

{% endfor %} + {% if available_apps %}

+ {% else %} +

+ {% blocktrans trimmed %} + No apps that support backup are currently installed. After any app + that supports backup has been installed, then it will be possible to + create backups. + {% endblocktrans %} +

+ {% endif %}

{% trans 'Backup archives' %}

{% if not archives %} diff --git a/plinth/modules/backups/views.py b/plinth/modules/backups/views.py index e0e1dc7cf..506854f8f 100644 --- a/plinth/modules/backups/views.py +++ b/plinth/modules/backups/views.py @@ -29,6 +29,7 @@ from django.views.generic import FormView, TemplateView from urllib.parse import unquote from plinth.modules import backups +from .backups import _list_of_all_apps_for_backup from .forms import CreateArchiveForm, ExportArchiveForm @@ -45,6 +46,8 @@ class IndexView(TemplateView): context['info'] = backups.get_info() context['archives'] = backups.list_archives() context['exports'] = backups.get_export_files() + apps = _list_of_all_apps_for_backup() + context['available_apps'] = [x[0] for x in apps] return context