diff --git a/plinth/modules/snapshot/templates/snapshot.html b/plinth/modules/snapshot/templates/snapshot.html index 5de3fef4e..aa3222f81 100644 --- a/plinth/modules/snapshot/templates/snapshot.html +++ b/plinth/modules/snapshot/templates/snapshot.html @@ -40,11 +40,11 @@
+ {% if not has_deletable_snapshots %} + disabled="disabled" + {% else %} + href="{% url 'snapshot:delete-all' %}" + {% endif %}> {% trans 'Delete All' %}
diff --git a/plinth/modules/snapshot/views.py b/plinth/modules/snapshot/views.py index 0621e6d32..7129c0ef6 100644 --- a/plinth/modules/snapshot/views.py +++ b/plinth/modules/snapshot/views.py @@ -52,11 +52,15 @@ def index(request): output = actions.superuser_run('snapshot', ['list']) snapshots = json.loads(output) + has_deletable_snapshots = any( + [snapshot for snapshot in snapshots[1:] + if not snapshot['is_default']]) return TemplateResponse(request, 'snapshot.html', { 'title': snapshot_module.name, 'description': snapshot_module.description, 'snapshots': snapshots, + 'has_deletable_snapshots': has_deletable_snapshots, 'form': form })