From a12d94a3bcb074cd769d85c94b0eeade7ceee483 Mon Sep 17 00:00:00 2001 From: kobayashi Date: Thu, 23 Jul 2020 01:36:31 -0400 Subject: [PATCH] Fixes #4880: Fix remove untagged-vlans if not assigned in bulk interfaces edit --- docs/release-notes/version-2.8.md | 1 + netbox/utilities/views.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-2.8.md b/docs/release-notes/version-2.8.md index fb5e8277f..35f91a94d 100644 --- a/docs/release-notes/version-2.8.md +++ b/docs/release-notes/version-2.8.md @@ -6,6 +6,7 @@ * [#4875](https://github.com/netbox-community/netbox/issues/4875) - Fix documentation for image attachments * [#4876](https://github.com/netbox-community/netbox/issues/4876) - Fix labels for sites in staging or decommissioning status +* [#4880](https://github.com/netbox-community/netbox/issues/4880) - Fix remove tagged vlans if not assigned in bulk interface editting --- diff --git a/netbox/utilities/views.py b/netbox/utilities/views.py index 38fb6d963..cd8ac03c9 100644 --- a/netbox/utilities/views.py +++ b/netbox/utilities/views.py @@ -721,8 +721,8 @@ class BulkEditView(GetReturnURLMixin, View): # ManyToManyFields elif isinstance(model_field, ManyToManyField): - getattr(obj, name).set(form.cleaned_data[name]) - + if form.cleaned_data[name].count() > 0: + getattr(obj, name).set(form.cleaned_data[name]) # Normal fields elif form.cleaned_data[name] not in (None, ''): setattr(obj, name, form.cleaned_data[name])