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

Adapt device component import forms from #3711

Jeremy Stretch 6 лет назад
Родитель
Сommit
b0c0adf6e7
1 измененных файлов с 7 добавлено и 7 удалено
  1. 7 7
      netbox/dcim/forms.py

+ 7 - 7
netbox/dcim/forms.py

@@ -2371,7 +2371,7 @@ class PowerOutletCSVForm(forms.ModelForm):
         }
         }
     )
     )
     feed_leg = CSVChoiceField(
     feed_leg = CSVChoiceField(
-        choices=POWERFEED_LEG_CHOICES,
+        choices=PowerOutletFeedLegChoices,
         required=False,
         required=False,
     )
     )
 
 
@@ -2690,10 +2690,10 @@ class InterfaceCSVForm(forms.ModelForm):
         }
         }
     )
     )
     type = CSVChoiceField(
     type = CSVChoiceField(
-        choices=IFACE_TYPE_CHOICES,
+        choices=InterfaceTypeChoices,
     )
     )
     mode = CSVChoiceField(
     mode = CSVChoiceField(
-        choices=IFACE_MODE_CHOICES,
+        choices=InterfaceModeChoices,
         required=False,
         required=False,
     )
     )
 
 
@@ -2715,7 +2715,7 @@ class InterfaceCSVForm(forms.ModelForm):
 
 
         if device:
         if device:
             self.fields['lag'].queryset = Interface.objects.filter(
             self.fields['lag'].queryset = Interface.objects.filter(
-                device__in=[device, device.get_vc_master()], type=IFACE_TYPE_LAG
+                device__in=[device, device.get_vc_master()], type=InterfaceTypeChoices.TYPE_LAG
             )
             )
         else:
         else:
             self.fields['lag'].queryset = Interface.objects.none()
             self.fields['lag'].queryset = Interface.objects.none()
@@ -2966,7 +2966,7 @@ class FrontPortCSVForm(forms.ModelForm):
         }
         }
     )
     )
     type = CSVChoiceField(
     type = CSVChoiceField(
-        choices=PORT_TYPE_CHOICES,
+        choices=PortTypeChoices,
     )
     )
 
 
     class Meta:
     class Meta:
@@ -3084,7 +3084,7 @@ class RearPortCSVForm(forms.ModelForm):
         }
         }
     )
     )
     type = CSVChoiceField(
     type = CSVChoiceField(
-        choices=PORT_TYPE_CHOICES,
+        choices=PortTypeChoices,
     )
     )
 
 
     class Meta:
     class Meta:
@@ -3708,7 +3708,7 @@ class DeviceBayCSVForm(forms.ModelForm):
                 rack=device.rack,
                 rack=device.rack,
                 parent_bay__isnull=True,
                 parent_bay__isnull=True,
                 device_type__u_height=0,
                 device_type__u_height=0,
-                device_type__subdevice_role=SUBDEVICE_ROLE_CHILD
+                device_type__subdevice_role=SubdeviceRoleChoices.ROLE_CHILD
             ).exclude(pk=device.pk)
             ).exclude(pk=device.pk)
         else:
         else:
             self.fields['installed_device'].queryset = Interface.objects.none()
             self.fields['installed_device'].queryset = Interface.objects.none()