From 561f1c308cfd4bf417ef22894b2494ebeff8a16b Mon Sep 17 00:00:00 2001 From: Johanna England Date: Thu, 21 Nov 2024 15:01:57 +0100 Subject: [PATCH] Disable deleting of default dashboard --- python/nav/web/webfront/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/nav/web/webfront/views.py b/python/nav/web/webfront/views.py index 85bdb88be5..adb4307290 100644 --- a/python/nav/web/webfront/views.py +++ b/python/nav/web/webfront/views.py @@ -432,6 +432,10 @@ def delete_dashboard(request, did): return HttpResponseBadRequest('Cannot delete last dashboard') dash = get_object_or_404(AccountDashboard, pk=did, account=request.account) + + if dash.is_default: + return HttpResponseBadRequest('Cannot delete default dashboard') + dash.delete() return HttpResponse('Dashboard deleted')