1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Adapt device component import forms from #3711

This commit is contained in:
Jeremy Stretch
2019-12-05 17:49:44 -05:00
parent 17898a4c57
commit b0c0adf6e7

View File

@ -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()