mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 03:56:53 -06:00
Set display_field where needed
This commit is contained in:
parent
0b14b66727
commit
53f9f82317
@ -704,6 +704,7 @@ class RackReservationForm(BootstrapMixin, TenancyForm, forms.ModelForm):
|
||||
)
|
||||
rack = DynamicModelChoiceField(
|
||||
queryset=Rack.objects.all(),
|
||||
display_field='display_name',
|
||||
query_params={
|
||||
'site_id': '$site',
|
||||
'group_id': 'rack',
|
||||
@ -1999,10 +2000,17 @@ class DeviceBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditF
|
||||
queryset=Device.objects.all(),
|
||||
widget=forms.MultipleHiddenInput()
|
||||
)
|
||||
manufacturer = DynamicModelChoiceField(
|
||||
queryset=Manufacturer.objects.all(),
|
||||
required=False
|
||||
)
|
||||
device_type = DynamicModelChoiceField(
|
||||
queryset=DeviceType.objects.all(),
|
||||
required=False,
|
||||
display_field='model'
|
||||
display_field='model',
|
||||
query_params={
|
||||
'manufacturer_id': '$manufacturer'
|
||||
}
|
||||
)
|
||||
device_role = DynamicModelChoiceField(
|
||||
queryset=DeviceRole.objects.all(),
|
||||
@ -2177,7 +2185,8 @@ class ComponentCreateForm(ComponentForm):
|
||||
Base form for the creation of device components (models subclassed from ComponentModel).
|
||||
"""
|
||||
device = DynamicModelChoiceField(
|
||||
queryset=Device.objects.all()
|
||||
queryset=Device.objects.all(),
|
||||
display_field='display_name'
|
||||
)
|
||||
description = forms.CharField(
|
||||
max_length=100,
|
||||
@ -3257,7 +3266,8 @@ class DeviceBayCSVForm(CSVModelForm):
|
||||
|
||||
class InventoryItemForm(BootstrapMixin, forms.ModelForm):
|
||||
device = DynamicModelChoiceField(
|
||||
queryset=Device.objects.prefetch_related('device_type__manufacturer')
|
||||
queryset=Device.objects.all(),
|
||||
display_field='display_name'
|
||||
)
|
||||
manufacturer = DynamicModelChoiceField(
|
||||
queryset=Manufacturer.objects.all(),
|
||||
@ -3383,6 +3393,7 @@ class ConnectCableToDeviceForm(BootstrapMixin, forms.ModelForm):
|
||||
queryset=Rack.objects.all(),
|
||||
label='Rack',
|
||||
required=False,
|
||||
display_field='display_name',
|
||||
null_option='None',
|
||||
query_params={
|
||||
'site_id': '$termination_b_site'
|
||||
@ -3902,6 +3913,7 @@ class VirtualChassisCreateForm(BootstrapMixin, forms.ModelForm):
|
||||
queryset=Rack.objects.all(),
|
||||
required=False,
|
||||
null_option='None',
|
||||
display_field='display_name',
|
||||
query_params={
|
||||
'site_id': '$site'
|
||||
}
|
||||
@ -4032,6 +4044,7 @@ class VCMemberSelectForm(BootstrapMixin, forms.Form):
|
||||
queryset=Rack.objects.all(),
|
||||
required=False,
|
||||
null_option='None',
|
||||
display_field='display_name',
|
||||
query_params={
|
||||
'site_id': '$site'
|
||||
}
|
||||
@ -4244,6 +4257,7 @@ class PowerFeedForm(BootstrapMixin, CustomFieldModelForm):
|
||||
rack = DynamicModelChoiceField(
|
||||
queryset=Rack.objects.all(),
|
||||
required=False,
|
||||
display_field='display_name',
|
||||
query_params={
|
||||
'site_id': '$site'
|
||||
}
|
||||
@ -4356,7 +4370,8 @@ class PowerFeedBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEd
|
||||
)
|
||||
rack = DynamicModelChoiceField(
|
||||
queryset=Rack.objects.all(),
|
||||
required=False
|
||||
required=False,
|
||||
display_field='display_name'
|
||||
)
|
||||
status = forms.ChoiceField(
|
||||
choices=add_blank_choice(PowerFeedStatusChoices),
|
||||
|
@ -250,7 +250,8 @@ class PrefixForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
vrf = DynamicModelChoiceField(
|
||||
queryset=VRF.objects.all(),
|
||||
required=False,
|
||||
label='VRF'
|
||||
label='VRF',
|
||||
display_field='display_name'
|
||||
)
|
||||
site = DynamicModelChoiceField(
|
||||
queryset=Site.objects.all(),
|
||||
@ -498,7 +499,8 @@ class PrefixFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldFilterForm)
|
||||
class IPAddressForm(BootstrapMixin, TenancyForm, ReturnURLForm, CustomFieldModelForm):
|
||||
device = DynamicModelChoiceField(
|
||||
queryset=Device.objects.all(),
|
||||
required=False
|
||||
required=False,
|
||||
display_field='display_name'
|
||||
)
|
||||
interface = DynamicModelChoiceField(
|
||||
queryset=Interface.objects.all(),
|
||||
@ -561,7 +563,7 @@ class IPAddressForm(BootstrapMixin, TenancyForm, ReturnURLForm, CustomFieldModel
|
||||
display_field='address',
|
||||
query_params={
|
||||
'device_id': '$nat_device',
|
||||
'vrf_if': '$nat_vrf',
|
||||
'vrf_id': '$nat_vrf',
|
||||
}
|
||||
)
|
||||
primary_for_parent = forms.BooleanField(
|
||||
|
@ -63,7 +63,8 @@ class SecretRoleCSVForm(CSVModelForm):
|
||||
|
||||
class SecretForm(BootstrapMixin, CustomFieldModelForm):
|
||||
device = DynamicModelChoiceField(
|
||||
queryset=Device.objects.all()
|
||||
queryset=Device.objects.all(),
|
||||
display_field='display_name'
|
||||
)
|
||||
plaintext = forms.CharField(
|
||||
max_length=SECRET_PLAINTEXT_MAX_LENGTH,
|
||||
|
@ -208,6 +208,7 @@ class ClusterAddDevicesForm(BootstrapMixin, forms.Form):
|
||||
queryset=Rack.objects.all(),
|
||||
required=False,
|
||||
null_option='None',
|
||||
display_field='display_name',
|
||||
query_params={
|
||||
'site_id': '$site'
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user