Remove help text override from regular (direct) object creation of device components

This commit is contained in:
Brian Tiemann 2024-11-20 19:26:04 -05:00
parent 1fb79c24e7
commit d0b7135dd8
3 changed files with 6 additions and 17 deletions

View File

@ -10,13 +10,6 @@ __all__ = (
'ModuleCommonForm' 'ModuleCommonForm'
) )
COMPONENT_BULK_CREATE_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>). The string "
"<code>{module}</code> will be replaced with the position of the assigned module, if any."
)
class InterfaceCommonForm(forms.Form): class InterfaceCommonForm(forms.Form):
mac_address = forms.CharField( mac_address = forms.CharField(
empty_value=None, empty_value=None,

View File

@ -19,7 +19,7 @@ from utilities.forms.rendering import FieldSet, InlineFields, TabbedGroups
from utilities.forms.widgets import APISelect, ClearableFileInput, HTMXSelect, NumberWithOptions, SelectWithPK from utilities.forms.widgets import APISelect, ClearableFileInput, HTMXSelect, NumberWithOptions, SelectWithPK
from virtualization.models import Cluster from virtualization.models import Cluster
from wireless.models import WirelessLAN, WirelessLANGroup from wireless.models import WirelessLAN, WirelessLANGroup
from .common import COMPONENT_BULK_CREATE_HELP_TEXT, InterfaceCommonForm, ModuleCommonForm from .common import InterfaceCommonForm, ModuleCommonForm
__all__ = ( __all__ = (
'CableForm', 'CableForm',
@ -910,7 +910,11 @@ class ModularComponentTemplateForm(ComponentTemplateForm):
self.fields['module_type'].disabled = True self.fields['module_type'].disabled = True
# Components attached to a module need to present this standardized substitution help text. # Components attached to a module need to present this standardized substitution help text.
self.fields['name'].help_text = _(COMPONENT_BULK_CREATE_HELP_TEXT) self.fields['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>). The string "
"<code>{module}</code> will be replaced with the position of the assigned module, if any."
)
class ConsolePortTemplateForm(ModularComponentTemplateForm): class ConsolePortTemplateForm(ModularComponentTemplateForm):

View File

@ -7,7 +7,6 @@ from utilities.forms.fields import DynamicModelChoiceField, DynamicModelMultiple
from utilities.forms.rendering import FieldSet from utilities.forms.rendering import FieldSet
from utilities.forms.widgets import APISelect from utilities.forms.widgets import APISelect
from . import model_forms from . import model_forms
from .common import COMPONENT_BULK_CREATE_HELP_TEXT
__all__ = ( __all__ = (
'ComponentCreateForm', 'ComponentCreateForm',
@ -53,13 +52,6 @@ class ComponentCreateForm(forms.Form):
# ComponentCreateView when creating objects. # ComponentCreateView when creating objects.
replication_fields = ('name', 'label') replication_fields = ('name', 'label')
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Components attached to a module need to present this standardized substitution help text.
if 'module' in self.fields:
self.fields['name'].help_text = _(COMPONENT_BULK_CREATE_HELP_TEXT)
def clean(self): def clean(self):
super().clean() super().clean()