From f71567b704a5b698c4f0cbc3f7fed8a84b842200 Mon Sep 17 00:00:00 2001 From: Johanna England Date: Fri, 25 Mar 2022 16:02:19 +0100 Subject: [PATCH] Fix deletion of quick links --- python/nav/web/webfront/views.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/python/nav/web/webfront/views.py b/python/nav/web/webfront/views.py index f30790929e..756dc0694a 100644 --- a/python/nav/web/webfront/views.py +++ b/python/nav/web/webfront/views.py @@ -365,16 +365,13 @@ def save_links(request): if request.method == 'POST': formset = NavbarLinkFormSet(request.POST) if formset.is_valid(): - for form in formset.deleted_forms: - instance = form.save(commit=False) - instance.account = account - instance.save() - instances = formset.save(commit=False) for instance in instances: instance.account = account instance.save() - new_message(request, 'Your links were saved.', type=Messages.SUCCESS) + for form in formset.deleted_objects: + instance = form.delete() + new_message(request, 'Your links were updated.', type=Messages.SUCCESS) else: context['navbar_formset'] = formset