Skip to content

Commit

Permalink
Merge pull request #2370 from johannaengland/delete-quick-links
Browse files Browse the repository at this point in the history
Fix deletion of quick links
  • Loading branch information
johannaengland authored Mar 29, 2022
2 parents 1f9c043 + f71567b commit 96baa4f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions python/nav/web/webfront/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 96baa4f

Please sign in to comment.