Просмотр исходного кода

Enable bulk editing of device location assignment

Jeremy Stretch 4 лет назад
Родитель
Сommit
30e4504ee5
1 измененных файлов с 9 добавлено и 2 удалено
  1. 9 2
      netbox/dcim/forms.py

+ 9 - 2
netbox/dcim/forms.py

@@ -2113,8 +2113,8 @@ class DeviceForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
         model = Device
         fields = [
             'name', 'device_role', 'device_type', 'serial', 'asset_tag', 'region', 'site_group', 'site', 'rack',
-            'position', 'face', 'status', 'platform', 'primary_ip4', 'primary_ip6', 'cluster_group', 'cluster',
-            'tenant_group', 'tenant', 'comments', 'tags', 'local_context_data'
+            'location', 'position', 'face', 'status', 'platform', 'primary_ip4', 'primary_ip6', 'cluster_group',
+            'cluster', 'tenant_group', 'tenant', 'comments', 'tags', 'local_context_data'
         ]
         help_texts = {
             'device_role': "The function this device serves",
@@ -2357,6 +2357,13 @@ class DeviceBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditF
         queryset=Site.objects.all(),
         required=False
     )
+    location = DynamicModelChoiceField(
+        queryset=Location.objects.all(),
+        required=False,
+        query_params={
+            'site_id': '$site'
+        }
+    )
     tenant = DynamicModelChoiceField(
         queryset=Tenant.objects.all(),
         required=False