Jelajahi Sumber

Fixes #5355: Limit rack groups by selected site when editing a rack

Jeremy Stretch 5 tahun lalu
induk
melakukan
f2bc6f0f96
2 mengubah file dengan 8 tambahan dan 0 penghapusan
  1. 1 0
      docs/release-notes/version-2.9.md
  2. 7 0
      netbox/dcim/forms.py

+ 1 - 0
docs/release-notes/version-2.9.md

@@ -11,6 +11,7 @@
 * [#5235](https://github.com/netbox-community/netbox/issues/5235) - Fix exception when editing IP address with a NAT IP assigned to a non-racked device
 * [#5235](https://github.com/netbox-community/netbox/issues/5235) - Fix exception when editing IP address with a NAT IP assigned to a non-racked device
 * [#5345](https://github.com/netbox-community/netbox/issues/5345) - Fix non-deterministic ordering of prefixes and IP addresses
 * [#5345](https://github.com/netbox-community/netbox/issues/5345) - Fix non-deterministic ordering of prefixes and IP addresses
 * [#5350](https://github.com/netbox-community/netbox/issues/5350) - Filter available racks by selected group when creating a rack reservation
 * [#5350](https://github.com/netbox-community/netbox/issues/5350) - Filter available racks by selected group when creating a rack reservation
+* [#5355](https://github.com/netbox-community/netbox/issues/5355) - Limit rack groups by selected site when editing a rack
 
 
 ---
 ---
 
 

+ 7 - 0
netbox/dcim/forms.py

@@ -470,6 +470,13 @@ class RackForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
             'region_id': '$region'
             'region_id': '$region'
         }
         }
     )
     )
+    group = DynamicModelChoiceField(
+        queryset=RackGroup.objects.all(),
+        required=False,
+        query_params={
+            'site_id': '$site'
+        }
+    )
     role = DynamicModelChoiceField(
     role = DynamicModelChoiceField(
         queryset=RackRole.objects.all(),
         queryset=RackRole.objects.all(),
         required=False
         required=False