diff --git a/python/nav/web/static/js/src/webfront.js b/python/nav/web/static/js/src/webfront.js index 6099c3af05..ae36bb173a 100644 --- a/python/nav/web/static/js/src/webfront.js +++ b/python/nav/web/static/js/src/webfront.js @@ -289,7 +289,7 @@ require([ window.location = '/'; }); request.fail(function (response) { - feedback.addFeedback(response, 'error'); + feedback.addFeedback(response.responseText, 'error'); }); } }); diff --git a/python/nav/web/webfront/views.py b/python/nav/web/webfront/views.py index c98f0e7732..85bdb88be5 100644 --- a/python/nav/web/webfront/views.py +++ b/python/nav/web/webfront/views.py @@ -24,6 +24,7 @@ from urllib.parse import quote as urlquote from django.http import ( + HttpResponseBadRequest, HttpResponseForbidden, HttpResponseRedirect, HttpResponse, @@ -428,7 +429,7 @@ def delete_dashboard(request, did): """Delete this dashboard and all widgets on it""" is_last = AccountDashboard.objects.filter(account=request.account).count() == 1 if is_last: - return HttpResponse('Can not delete last dashboard', status=400) + return HttpResponseBadRequest('Cannot delete last dashboard') dash = get_object_or_404(AccountDashboard, pk=did, account=request.account) dash.delete()