Simplify help text replacement string for component forms with 'module' field

This commit is contained in:
Brian Tiemann 2024-11-08 10:26:13 -05:00
parent ba7dbcfc4f
commit d6bde32056

View File

@ -57,13 +57,11 @@ class ComponentCreateForm(forms.Form):
# Components attached to a module need to present this standardized substitution help text.
if 'module' in self.fields:
help_text_parts = []
if self.fields['name'].help_text:
help_text_parts.append(self.fields['name'].help_text)
help_text_parts.append(_(
"The string <code>{module}</code> will be replaced with the position of the assigned module, if any."
))
self.fields['name'].help_text = ' '.join([str(x) for x in help_text_parts])
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."
)
def clean(self):
super().clean()