mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Move nullable_fields out of Meta for bulk edit forms
This commit is contained in:
@ -47,7 +47,6 @@ class ProviderBulkEditForm(NetBoxModelBulkEditForm):
|
||||
label='Comments'
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'asn', 'account', 'portal_url', 'noc_contact', 'admin_contact', 'comments',
|
||||
)
|
||||
@ -75,7 +74,6 @@ class ProviderNetworkBulkEditForm(NetBoxModelBulkEditForm):
|
||||
label='Comments'
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'service_id', 'description', 'comments',
|
||||
)
|
||||
@ -91,7 +89,6 @@ class CircuitTypeBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('description',)
|
||||
|
||||
|
||||
@ -131,7 +128,6 @@ class CircuitBulkEditForm(NetBoxModelBulkEditForm):
|
||||
label='Comments'
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'tenant', 'commit_rate', 'description', 'comments',
|
||||
)
|
||||
|
@ -71,7 +71,6 @@ class RegionBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('parent', 'description')
|
||||
|
||||
|
||||
@ -89,7 +88,6 @@ class SiteGroupBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('parent', 'description')
|
||||
|
||||
|
||||
@ -131,7 +129,6 @@ class SiteBulkEditForm(NetBoxModelBulkEditForm):
|
||||
widget=StaticSelect()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'region', 'group', 'tenant', 'asns', 'description', 'time_zone',
|
||||
)
|
||||
@ -162,7 +159,6 @@ class LocationBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('parent', 'tenant', 'description')
|
||||
|
||||
|
||||
@ -179,7 +175,6 @@ class RackRoleBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('color', 'description')
|
||||
|
||||
|
||||
@ -277,7 +272,6 @@ class RackBulkEditForm(NetBoxModelBulkEditForm):
|
||||
label='Comments'
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'location', 'tenant', 'role', 'serial', 'asset_tag', 'outer_width', 'outer_depth', 'outer_unit', 'comments',
|
||||
)
|
||||
@ -315,7 +309,6 @@ class ManufacturerBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('description',)
|
||||
|
||||
|
||||
@ -346,7 +339,6 @@ class DeviceTypeBulkEditForm(NetBoxModelBulkEditForm):
|
||||
widget=StaticSelect()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('part_number', 'airflow')
|
||||
|
||||
|
||||
@ -363,7 +355,6 @@ class ModuleTypeBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('part_number',)
|
||||
|
||||
|
||||
@ -385,7 +376,6 @@ class DeviceRoleBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('color', 'description')
|
||||
|
||||
|
||||
@ -408,7 +398,6 @@ class PlatformBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('manufacturer', 'napalm_driver', 'description')
|
||||
|
||||
|
||||
@ -467,7 +456,6 @@ class DeviceBulkEditForm(NetBoxModelBulkEditForm):
|
||||
label='Serial Number'
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'tenant', 'platform', 'serial', 'airflow',
|
||||
)
|
||||
@ -495,7 +483,6 @@ class ModuleBulkEditForm(NetBoxModelBulkEditForm):
|
||||
label='Serial Number'
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('serial',)
|
||||
|
||||
|
||||
@ -538,7 +525,6 @@ class CableBulkEditForm(NetBoxModelBulkEditForm):
|
||||
widget=StaticSelect()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'type', 'status', 'tenant', 'label', 'color', 'length',
|
||||
)
|
||||
@ -565,7 +551,6 @@ class VirtualChassisBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('domain',)
|
||||
|
||||
|
||||
@ -604,7 +589,6 @@ class PowerPanelBulkEditForm(NetBoxModelBulkEditForm):
|
||||
}
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('location',)
|
||||
|
||||
|
||||
@ -663,10 +647,7 @@ class PowerFeedBulkEditForm(NetBoxModelBulkEditForm):
|
||||
label='Comments'
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'location', 'comments',
|
||||
)
|
||||
nullable_fields = ('location', 'comments')
|
||||
|
||||
|
||||
#
|
||||
@ -688,7 +669,6 @@ class ConsolePortTemplateBulkEditForm(BulkEditForm):
|
||||
widget=StaticSelect()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('label', 'type', 'description')
|
||||
|
||||
|
||||
@ -710,7 +690,6 @@ class ConsoleServerPortTemplateBulkEditForm(BulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('label', 'type', 'description')
|
||||
|
||||
|
||||
@ -742,7 +721,6 @@ class PowerPortTemplateBulkEditForm(BulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('label', 'type', 'maximum_draw', 'allocated_draw', 'description')
|
||||
|
||||
|
||||
@ -779,7 +757,6 @@ class PowerOutletTemplateBulkEditForm(BulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('label', 'type', 'power_port', 'feed_leg', 'description')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -817,7 +794,6 @@ class InterfaceTemplateBulkEditForm(BulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('label', 'description')
|
||||
|
||||
|
||||
@ -842,7 +818,6 @@ class FrontPortTemplateBulkEditForm(BulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('description',)
|
||||
|
||||
|
||||
@ -867,7 +842,6 @@ class RearPortTemplateBulkEditForm(BulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('description',)
|
||||
|
||||
|
||||
@ -884,7 +858,6 @@ class ModuleBayTemplateBulkEditForm(BulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('label', 'position', 'description')
|
||||
|
||||
|
||||
@ -901,7 +874,6 @@ class DeviceBayTemplateBulkEditForm(BulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('label', 'description')
|
||||
|
||||
|
||||
@ -926,7 +898,6 @@ class InventoryItemTemplateBulkEditForm(BulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('label', 'role', 'manufacturer', 'part_id', 'description')
|
||||
|
||||
|
||||
@ -947,7 +918,6 @@ class ConsolePortBulkEditForm(
|
||||
widget=BulkEditNullBooleanSelect
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('label', 'description')
|
||||
|
||||
|
||||
@ -964,7 +934,6 @@ class ConsoleServerPortBulkEditForm(
|
||||
widget=BulkEditNullBooleanSelect
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('label', 'description')
|
||||
|
||||
|
||||
@ -981,7 +950,6 @@ class PowerPortBulkEditForm(
|
||||
widget=BulkEditNullBooleanSelect
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('label', 'description')
|
||||
|
||||
|
||||
@ -1004,7 +972,6 @@ class PowerOutletBulkEditForm(
|
||||
widget=BulkEditNullBooleanSelect
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('label', 'type', 'feed_leg', 'power_port', 'description')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -1084,11 +1051,9 @@ class InterfaceBulkEditForm(
|
||||
label='VRF'
|
||||
)
|
||||
|
||||
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',
|
||||
'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'tx_power', 'untagged_vlan', 'tagged_vlans', 'vrf',
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -1154,7 +1119,6 @@ class FrontPortBulkEditForm(
|
||||
widget=forms.MultipleHiddenInput()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('label', 'description')
|
||||
|
||||
|
||||
@ -1167,7 +1131,6 @@ class RearPortBulkEditForm(
|
||||
widget=forms.MultipleHiddenInput()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('label', 'description')
|
||||
|
||||
|
||||
@ -1180,7 +1143,6 @@ class ModuleBayBulkEditForm(
|
||||
widget=forms.MultipleHiddenInput()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('label', 'position', 'description')
|
||||
|
||||
|
||||
@ -1193,7 +1155,6 @@ class DeviceBayBulkEditForm(
|
||||
widget=forms.MultipleHiddenInput()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('label', 'description')
|
||||
|
||||
|
||||
@ -1214,7 +1175,6 @@ class InventoryItemBulkEditForm(
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('label', 'role', 'manufacturer', 'part_id', 'description')
|
||||
|
||||
|
||||
@ -1235,5 +1195,4 @@ class InventoryItemRoleBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('color', 'description')
|
||||
|
@ -33,7 +33,6 @@ class CustomFieldBulkEditForm(BulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('description',)
|
||||
|
||||
|
||||
@ -92,7 +91,6 @@ class ExportTemplateBulkEditForm(BulkEditForm):
|
||||
widget=BulkEditNullBooleanSelect()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('description', 'mime_type', 'file_extension')
|
||||
|
||||
|
||||
@ -135,7 +133,6 @@ class WebhookBulkEditForm(BulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('secret', 'conditions', 'ca_file_path')
|
||||
|
||||
|
||||
@ -152,7 +149,6 @@ class TagBulkEditForm(BulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('description',)
|
||||
|
||||
|
||||
@ -174,7 +170,6 @@ class ConfigContextBulkEditForm(BulkEditForm):
|
||||
max_length=100
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('description',)
|
||||
|
||||
|
||||
|
@ -49,10 +49,7 @@ class VRFBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'tenant', 'description',
|
||||
)
|
||||
nullable_fields = ('tenant', 'description')
|
||||
|
||||
|
||||
class RouteTargetBulkEditForm(NetBoxModelBulkEditForm):
|
||||
@ -69,10 +66,7 @@ class RouteTargetBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'tenant', 'description',
|
||||
)
|
||||
nullable_fields = ('tenant', 'description')
|
||||
|
||||
|
||||
class RIRBulkEditForm(NetBoxModelBulkEditForm):
|
||||
@ -89,7 +83,6 @@ class RIRBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('is_private', 'description')
|
||||
|
||||
|
||||
@ -116,13 +109,7 @@ class ASNBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'date_added', 'description',
|
||||
)
|
||||
widgets = {
|
||||
'date_added': DatePicker(),
|
||||
}
|
||||
nullable_fields = ('date_added', 'description')
|
||||
|
||||
|
||||
class AggregateBulkEditForm(NetBoxModelBulkEditForm):
|
||||
@ -147,13 +134,7 @@ class AggregateBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'date_added', 'description',
|
||||
)
|
||||
widgets = {
|
||||
'date_added': DatePicker(),
|
||||
}
|
||||
nullable_fields = ('date_added', 'description')
|
||||
|
||||
|
||||
class RoleBulkEditForm(NetBoxModelBulkEditForm):
|
||||
@ -169,7 +150,6 @@ class RoleBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('description',)
|
||||
|
||||
|
||||
@ -232,7 +212,6 @@ class PrefixBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'site', 'vrf', 'tenant', 'role', 'description',
|
||||
)
|
||||
@ -266,7 +245,6 @@ class IPRangeBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'vrf', 'tenant', 'role', 'description',
|
||||
)
|
||||
@ -311,7 +289,6 @@ class IPAddressBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'vrf', 'role', 'tenant', 'dns_name', 'description',
|
||||
)
|
||||
@ -348,7 +325,6 @@ class FHRPGroupBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('auth_type', 'auth_key', 'description')
|
||||
|
||||
|
||||
@ -378,7 +354,6 @@ class VLANGroupBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('site', 'description')
|
||||
|
||||
|
||||
@ -428,7 +403,6 @@ class VLANBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'site', 'group', 'tenant', 'role', 'description',
|
||||
)
|
||||
@ -456,7 +430,6 @@ class ServiceTemplateBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('description',)
|
||||
|
||||
|
||||
|
@ -31,7 +31,6 @@ class TenantGroupBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('parent', 'description')
|
||||
|
||||
|
||||
@ -45,7 +44,6 @@ class TenantBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('group',)
|
||||
|
||||
|
||||
@ -67,7 +65,6 @@ class ContactGroupBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('parent', 'description')
|
||||
|
||||
|
||||
@ -81,7 +78,6 @@ class ContactRoleBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('description',)
|
||||
|
||||
|
||||
@ -110,5 +106,4 @@ class ContactBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('group', 'title', 'phone', 'email', 'address', 'comments')
|
||||
|
@ -69,14 +69,11 @@ class BulkEditMixin:
|
||||
"""
|
||||
Base form for editing multiple objects in bulk
|
||||
"""
|
||||
nullable_fields = ()
|
||||
|
||||
def __init__(self, model, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.model = model
|
||||
self.nullable_fields = ()
|
||||
|
||||
# Copy any nullable fields defined in Meta
|
||||
if hasattr(self, 'Meta') and hasattr(self.Meta, 'nullable_fields'):
|
||||
self.nullable_fields = self.Meta.nullable_fields
|
||||
|
||||
|
||||
#
|
||||
|
@ -33,7 +33,6 @@ class ClusterTypeBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('description',)
|
||||
|
||||
|
||||
@ -47,7 +46,6 @@ class ClusterGroupBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('description',)
|
||||
|
||||
|
||||
@ -89,7 +87,6 @@ class ClusterBulkEditForm(NetBoxModelBulkEditForm):
|
||||
label='Comments'
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'group', 'site', 'comments', 'tenant',
|
||||
)
|
||||
@ -144,7 +141,6 @@ class VirtualMachineBulkEditForm(NetBoxModelBulkEditForm):
|
||||
label='Comments'
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'role', 'tenant', 'platform', 'vcpus', 'memory', 'disk', 'comments',
|
||||
)
|
||||
@ -197,7 +193,6 @@ class VMInterfaceBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = (
|
||||
'parent', 'bridge', 'mtu', 'description',
|
||||
)
|
||||
|
@ -29,7 +29,6 @@ class WirelessLANGroupBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('parent', 'description')
|
||||
|
||||
|
||||
@ -68,8 +67,9 @@ class WirelessLANBulkEditForm(NetBoxModelBulkEditForm):
|
||||
label='Pre-shared key'
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('ssid', 'group', 'vlan', 'description', 'auth_type', 'auth_cipher', 'auth_psk')
|
||||
nullable_fields = (
|
||||
'ssid', 'group', 'vlan', 'description', 'auth_type', 'auth_cipher', 'auth_psk',
|
||||
)
|
||||
|
||||
|
||||
class WirelessLinkBulkEditForm(NetBoxModelBulkEditForm):
|
||||
@ -102,5 +102,6 @@ class WirelessLinkBulkEditForm(NetBoxModelBulkEditForm):
|
||||
label='Pre-shared key'
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ('ssid', 'description', 'auth_type', 'auth_cipher', 'auth_psk')
|
||||
nullable_fields = (
|
||||
'ssid', 'description', 'auth_type', 'auth_cipher', 'auth_psk',
|
||||
)
|
||||
|
Reference in New Issue
Block a user