mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-24 00:15:17 -06:00
Clean up expandable field help texts
This commit is contained in:
parent
1fd23daa07
commit
0d39efdc44
@ -1385,7 +1385,7 @@ class InterfaceForm(InterfaceCommonForm, ModularDeviceComponentForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
('Interface', ('device', 'module', 'name', 'type', 'speed', 'duplex', 'label', 'description', 'tags')),
|
('Interface', ('device', 'module', 'name', 'label', 'type', 'speed', 'duplex', 'description', 'tags')),
|
||||||
('Addressing', ('vrf', 'mac_address', 'wwn')),
|
('Addressing', ('vrf', 'mac_address', 'wwn')),
|
||||||
('Operation', ('mtu', 'tx_power', 'enabled', 'mgmt_only', 'mark_connected')),
|
('Operation', ('mtu', 'tx_power', 'enabled', 'mgmt_only', 'mark_connected')),
|
||||||
('Related Interfaces', ('parent', 'bridge', 'lag')),
|
('Related Interfaces', ('parent', 'bridge', 'lag')),
|
||||||
|
@ -39,7 +39,7 @@ class ComponentCreateForm(forms.Form):
|
|||||||
name = ExpandableNameField()
|
name = ExpandableNameField()
|
||||||
label = ExpandableNameField(
|
label = ExpandableNameField(
|
||||||
required=False,
|
required=False,
|
||||||
help_text='Alphanumeric ranges are supported. (Must match the number of names being created.)'
|
help_text='Alphanumeric ranges are supported. (Must match the number of objects being created.)'
|
||||||
)
|
)
|
||||||
|
|
||||||
replication_fields = ('name', 'label')
|
replication_fields = ('name', 'label')
|
||||||
@ -58,20 +58,6 @@ class ComponentCreateForm(forms.Form):
|
|||||||
}, code='label_pattern_mismatch')
|
}, code='label_pattern_mismatch')
|
||||||
|
|
||||||
|
|
||||||
# class ModularComponentTemplateCreateForm(ComponentCreateForm):
|
|
||||||
# """
|
|
||||||
# Creation form for component templates that can be assigned to either a DeviceType *or* a ModuleType.
|
|
||||||
# """
|
|
||||||
# name = ExpandableNameField(
|
|
||||||
# label='Name',
|
|
||||||
# help_text="""
|
|
||||||
# Alphanumeric ranges are supported for bulk creation. Mixed cases and types within a single range
|
|
||||||
# are not supported. Example: <code>[ge,xe]-0/0/[0-9]</code>. {module} is accepted as a substitution for
|
|
||||||
# the module bay position.
|
|
||||||
# """
|
|
||||||
# )
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Device component templates
|
# Device component templates
|
||||||
#
|
#
|
||||||
@ -179,7 +165,7 @@ class ModuleBayTemplateCreateForm(ComponentCreateForm, model_forms.ModuleBayTemp
|
|||||||
position = ExpandableNameField(
|
position = ExpandableNameField(
|
||||||
label='Position',
|
label='Position',
|
||||||
required=False,
|
required=False,
|
||||||
help_text='Alphanumeric ranges are supported. (Must match the number of names being created.)'
|
help_text='Alphanumeric ranges are supported. (Must match the number of objects being created.)'
|
||||||
)
|
)
|
||||||
replication_fields = ('name', 'label', 'position')
|
replication_fields = ('name', 'label', 'position')
|
||||||
|
|
||||||
@ -226,6 +212,13 @@ class InterfaceCreateForm(ComponentCreateForm, model_forms.InterfaceForm):
|
|||||||
class Meta(model_forms.InterfaceForm.Meta):
|
class Meta(model_forms.InterfaceForm.Meta):
|
||||||
exclude = ('name', 'label')
|
exclude = ('name', 'label')
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
if 'module' in self.fields:
|
||||||
|
self.fields['name'].help_text += ' The string <code>{module}</code> will be replaced with the position ' \
|
||||||
|
'of the assigned module, if any'
|
||||||
|
|
||||||
|
|
||||||
class FrontPortCreateForm(ComponentCreateForm, model_forms.FrontPortForm):
|
class FrontPortCreateForm(ComponentCreateForm, model_forms.FrontPortForm):
|
||||||
rear_port = forms.MultipleChoiceField(
|
rear_port = forms.MultipleChoiceField(
|
||||||
@ -295,7 +288,7 @@ class ModuleBayCreateForm(ComponentCreateForm, model_forms.ModuleBayForm):
|
|||||||
position = ExpandableNameField(
|
position = ExpandableNameField(
|
||||||
label='Position',
|
label='Position',
|
||||||
required=False,
|
required=False,
|
||||||
help_text='Alphanumeric ranges are supported. (Must match the number of names being created.)'
|
help_text='Alphanumeric ranges are supported. (Must match the number of objects being created.)'
|
||||||
)
|
)
|
||||||
replication_fields = ('name', 'label', 'position')
|
replication_fields = ('name', 'label', 'position')
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class ExpandableNameField(forms.CharField):
|
|||||||
if not self.help_text:
|
if not self.help_text:
|
||||||
self.help_text = """
|
self.help_text = """
|
||||||
Alphanumeric ranges are supported for bulk creation. Mixed cases and types within a single range
|
Alphanumeric ranges are supported for bulk creation. Mixed cases and types within a single range
|
||||||
are not supported. Example: <code>[ge,xe]-0/0/[0-9]</code>
|
are not supported (example: <code>[ge,xe]-0/0/[0-9]</code>).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def to_python(self, value):
|
def to_python(self, value):
|
||||||
|
Loading…
Reference in New Issue
Block a user