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

Clean up nullable fields declaration for bulk edit forms

This commit is contained in:
jeremystretch
2022-01-28 16:47:54 -05:00
parent f4776731ec
commit e4eee1cdfc
9 changed files with 120 additions and 121 deletions

View File

@@ -72,7 +72,7 @@ class RegionBulkEditForm(NetBoxModelBulkEditForm):
)
class Meta:
nullable_fields = ['parent', 'description']
nullable_fields = ('parent', 'description')
class SiteGroupBulkEditForm(NetBoxModelBulkEditForm):
@@ -90,7 +90,7 @@ class SiteGroupBulkEditForm(NetBoxModelBulkEditForm):
)
class Meta:
nullable_fields = ['parent', 'description']
nullable_fields = ('parent', 'description')
class SiteBulkEditForm(NetBoxModelBulkEditForm):
@@ -132,9 +132,9 @@ class SiteBulkEditForm(NetBoxModelBulkEditForm):
)
class Meta:
nullable_fields = [
nullable_fields = (
'region', 'group', 'tenant', 'asns', 'description', 'time_zone',
]
)
class LocationBulkEditForm(NetBoxModelBulkEditForm):
@@ -163,7 +163,7 @@ class LocationBulkEditForm(NetBoxModelBulkEditForm):
)
class Meta:
nullable_fields = ['parent', 'tenant', 'description']
nullable_fields = ('parent', 'tenant', 'description')
class RackRoleBulkEditForm(NetBoxModelBulkEditForm):
@@ -180,7 +180,7 @@ class RackRoleBulkEditForm(NetBoxModelBulkEditForm):
)
class Meta:
nullable_fields = ['color', 'description']
nullable_fields = ('color', 'description')
class RackBulkEditForm(NetBoxModelBulkEditForm):
@@ -278,9 +278,9 @@ class RackBulkEditForm(NetBoxModelBulkEditForm):
)
class Meta:
nullable_fields = [
nullable_fields = (
'location', 'tenant', 'role', 'serial', 'asset_tag', 'outer_width', 'outer_depth', 'outer_unit', 'comments',
]
)
class RackReservationBulkEditForm(NetBoxModelBulkEditForm):
@@ -304,9 +304,6 @@ class RackReservationBulkEditForm(NetBoxModelBulkEditForm):
required=False
)
class Meta:
nullable_fields = []
class ManufacturerBulkEditForm(NetBoxModelBulkEditForm):
pk = forms.ModelMultipleChoiceField(
@@ -319,7 +316,7 @@ class ManufacturerBulkEditForm(NetBoxModelBulkEditForm):
)
class Meta:
nullable_fields = ['description']
nullable_fields = ('description',)
class DeviceTypeBulkEditForm(NetBoxModelBulkEditForm):
@@ -350,7 +347,7 @@ class DeviceTypeBulkEditForm(NetBoxModelBulkEditForm):
)
class Meta:
nullable_fields = ['part_number', 'airflow']
nullable_fields = ('part_number', 'airflow')
class ModuleTypeBulkEditForm(NetBoxModelBulkEditForm):
@@ -367,7 +364,7 @@ class ModuleTypeBulkEditForm(NetBoxModelBulkEditForm):
)
class Meta:
nullable_fields = ['part_number']
nullable_fields = ('part_number',)
class DeviceRoleBulkEditForm(NetBoxModelBulkEditForm):
@@ -389,7 +386,7 @@ class DeviceRoleBulkEditForm(NetBoxModelBulkEditForm):
)
class Meta:
nullable_fields = ['color', 'description']
nullable_fields = ('color', 'description')
class PlatformBulkEditForm(NetBoxModelBulkEditForm):
@@ -412,7 +409,7 @@ class PlatformBulkEditForm(NetBoxModelBulkEditForm):
)
class Meta:
nullable_fields = ['manufacturer', 'napalm_driver', 'description']
nullable_fields = ('manufacturer', 'napalm_driver', 'description')
class DeviceBulkEditForm(NetBoxModelBulkEditForm):
@@ -471,9 +468,9 @@ class DeviceBulkEditForm(NetBoxModelBulkEditForm):
)
class Meta:
nullable_fields = [
nullable_fields = (
'tenant', 'platform', 'serial', 'airflow',
]
)
class ModuleBulkEditForm(NetBoxModelBulkEditForm):
@@ -499,7 +496,7 @@ class ModuleBulkEditForm(NetBoxModelBulkEditForm):
)
class Meta:
nullable_fields = ['serial']
nullable_fields = ('serial',)
class CableBulkEditForm(NetBoxModelBulkEditForm):
@@ -542,9 +539,9 @@ class CableBulkEditForm(NetBoxModelBulkEditForm):
)
class Meta:
nullable_fields = [
nullable_fields = (
'type', 'status', 'tenant', 'label', 'color', 'length',
]
)
def clean(self):
super().clean()
@@ -569,7 +566,7 @@ class VirtualChassisBulkEditForm(NetBoxModelBulkEditForm):
)
class Meta:
nullable_fields = ['domain']
nullable_fields = ('domain',)
class PowerPanelBulkEditForm(NetBoxModelBulkEditForm):
@@ -608,7 +605,7 @@ class PowerPanelBulkEditForm(NetBoxModelBulkEditForm):
)
class Meta:
nullable_fields = ['location']
nullable_fields = ('location',)
class PowerFeedBulkEditForm(NetBoxModelBulkEditForm):
@@ -667,9 +664,9 @@ class PowerFeedBulkEditForm(NetBoxModelBulkEditForm):
)
class Meta:
nullable_fields = [
nullable_fields = (
'location', 'comments',
]
)
#
@@ -930,7 +927,7 @@ class InventoryItemTemplateBulkEditForm(BulkEditForm):
)
class Meta:
nullable_fields = ['label', 'role', 'manufacturer', 'part_id', 'description']
nullable_fields = ('label', 'role', 'manufacturer', 'part_id', 'description')
#
@@ -951,7 +948,7 @@ class ConsolePortBulkEditForm(
)
class Meta:
nullable_fields = ['label', 'description']
nullable_fields = ('label', 'description')
class ConsoleServerPortBulkEditForm(
@@ -968,7 +965,7 @@ class ConsoleServerPortBulkEditForm(
)
class Meta:
nullable_fields = ['label', 'description']
nullable_fields = ('label', 'description')
class PowerPortBulkEditForm(
@@ -985,7 +982,7 @@ class PowerPortBulkEditForm(
)
class Meta:
nullable_fields = ['label', 'description']
nullable_fields = ('label', 'description')
class PowerOutletBulkEditForm(
@@ -1008,7 +1005,7 @@ class PowerOutletBulkEditForm(
)
class Meta:
nullable_fields = ['label', 'type', 'feed_leg', 'power_port', 'description']
nullable_fields = ('label', 'type', 'feed_leg', 'power_port', 'description')
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -1088,10 +1085,11 @@ class InterfaceBulkEditForm(
)
class Meta:
nullable_fields = [
'label', 'parent', 'bridge', 'lag', 'speed', 'duplex', 'mac_address', 'wwn', 'mtu', 'description', 'mode', 'rf_channel',
'rf_channel_frequency', 'rf_channel_width', 'tx_power', 'untagged_vlan', 'tagged_vlans', 'vrf',
]
nullable_fields = (
'label', 'parent', 'bridge', 'lag', 'speed', 'duplex', 'mac_address', 'wwn', 'mtu', 'description', 'mode',
'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'tx_power', 'untagged_vlan', 'tagged_vlans',
'vrf',
)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -1157,7 +1155,7 @@ class FrontPortBulkEditForm(
)
class Meta:
nullable_fields = ['label', 'description']
nullable_fields = ('label', 'description')
class RearPortBulkEditForm(
@@ -1170,7 +1168,7 @@ class RearPortBulkEditForm(
)
class Meta:
nullable_fields = ['label', 'description']
nullable_fields = ('label', 'description')
class ModuleBayBulkEditForm(
@@ -1183,7 +1181,7 @@ class ModuleBayBulkEditForm(
)
class Meta:
nullable_fields = ['label', 'position', 'description']
nullable_fields = ('label', 'position', 'description')
class DeviceBayBulkEditForm(
@@ -1196,7 +1194,7 @@ class DeviceBayBulkEditForm(
)
class Meta:
nullable_fields = ['label', 'description']
nullable_fields = ('label', 'description')
class InventoryItemBulkEditForm(
@@ -1217,7 +1215,7 @@ class InventoryItemBulkEditForm(
)
class Meta:
nullable_fields = ['label', 'role', 'manufacturer', 'part_id', 'description']
nullable_fields = ('label', 'role', 'manufacturer', 'part_id', 'description')
#
@@ -1238,4 +1236,4 @@ class InventoryItemRoleBulkEditForm(NetBoxModelBulkEditForm):
)
class Meta:
nullable_fields = ['color', 'description']
nullable_fields = ('color', 'description')