Skip to content

Commit 55b3e4e

Browse files
committed
Fixes #9682: Fix bulk assignment of ASNs to sites
1 parent 29f6291 commit 55b3e4e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

docs/release-notes/version-3.2.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* [#8854](https://github.com/netbox-community/netbox/issues/8854) - Fix `REMOTE_AUTH_DEFAULT_GROUPS` for social-auth backends
1515
* [#9575](https://github.com/netbox-community/netbox/issues/9575) - Fix AttributeError exception for FHRP group with an IP address assigned
1616
* [#9597](https://github.com/netbox-community/netbox/issues/9597) - Include `installed_module` in module bay REST API serializer
17+
* [#9682](https://github.com/netbox-community/netbox/issues/9682) - Fix bulk assignment of ASNs to sites
1718

1819
---
1920

netbox/netbox/views/generic/bulk_views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from django.core.exceptions import FieldDoesNotExist, ValidationError
99
from django.db import transaction, IntegrityError
1010
from django.db.models import ManyToManyField, ProtectedError
11+
from django.db.models.fields.reverse_related import ManyToManyRel
1112
from django.forms import Form, ModelMultipleChoiceField, MultipleHiddenInput
1213
from django.http import HttpResponse
1314
from django.shortcuts import get_object_or_404, redirect, render
@@ -484,7 +485,7 @@ def _update_objects(self, form, request):
484485
setattr(obj, name, None if model_field.null else '')
485486

486487
# ManyToManyFields
487-
elif isinstance(model_field, ManyToManyField):
488+
elif isinstance(model_field, (ManyToManyField, ManyToManyRel)):
488489
if form.cleaned_data[name]:
489490
getattr(obj, name).set(form.cleaned_data[name])
490491
# Normal fields

0 commit comments

Comments
 (0)