Просмотр исходного кода

Fixes #9062 - Add/edit {module} substitution to help text for component template name

Daniel Sheppard 3 лет назад
Родитель
Сommit
890efa5400

+ 1 - 0
docs/release-notes/version-3.2.md

@@ -4,6 +4,7 @@
 
 ### Enhancements
 
+* [#9062](https://github.com/netbox-community/netbox/issues/9062) - Add/edit {module} substitution to help text for component template name 
 * [#9762](https://github.com/netbox-community/netbox/issues/9762) - Add `nat_outside` column to the IPAddress table
 * [#9825](https://github.com/netbox-community/netbox/issues/9825) - Add contacts column to virtual machines table
 

+ 8 - 0
netbox/dcim/forms/object_create.py

@@ -64,6 +64,14 @@ class ModularComponentTemplateCreateForm(ComponentCreateForm):
     """
     Creation form for component templates that can be assigned to either a DeviceType *or* a ModuleType.
     """
+    name_pattern = 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_type = DynamicModelChoiceField(
         queryset=DeviceType.objects.all(),
         required=False

+ 4 - 1
netbox/dcim/models/device_component_templates.py

@@ -39,7 +39,10 @@ class ComponentTemplateModel(WebhooksMixin, ChangeLoggedModel):
         related_name='%(class)ss'
     )
     name = models.CharField(
-        max_length=64
+        max_length=64,
+        help_text="""
+        {module} is accepted as a substitution for the module bay position when attached to a module type.
+        """
     )
     _name = NaturalOrderingField(
         target_field='name',