Clean up labels

This commit is contained in:
Jeremy Stretch 2024-07-13 10:41:32 -04:00
parent bbfcba4b93
commit 7a646cdc94
5 changed files with 8 additions and 7 deletions

View File

@ -473,7 +473,8 @@ class VLANGroupBulkEditForm(NetBoxModelBulkEditForm):
} }
) )
vlan_id_ranges = NumericRangeArrayField( vlan_id_ranges = NumericRangeArrayField(
required=False, label=_('VLAN ID ranges'),
required=False
) )
model = VLANGroup model = VLANGroup

View File

@ -634,6 +634,7 @@ class VLANGroupForm(NetBoxModelForm):
) )
slug = SlugField() slug = SlugField()
vlan_id_ranges = NumericRangeArrayField( vlan_id_ranges = NumericRangeArrayField(
label=_('VLAN IDs'),
required=False required=False
) )

View File

@ -54,9 +54,8 @@ class VLANGroup(OrganizationalModel):
) )
vlan_id_ranges = ArrayField( vlan_id_ranges = ArrayField(
IntegerRangeField(), IntegerRangeField(),
verbose_name=_('min/max VLAN IDs'), verbose_name=_('VLAN ID ranges'),
default=get_default_vlan_ids, default=get_default_vlan_ids,
help_text=_('Ranges of Minimum, maximum VLAN IDs'),
blank=True, blank=True,
null=True null=True
) )

View File

@ -39,7 +39,7 @@
<td>{{ object.scope|linkify|placeholder }}</td> <td>{{ object.scope|linkify|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">{% trans "Permitted VIDs" %}</th> <th scope="row">{% trans "VLAN IDs" %}</th>
<td>{{ object.vlan_ranges }}</td> <td>{{ object.vlan_ranges }}</td>
</tr> </tr>
<tr> <tr>

View File

@ -1,5 +1,6 @@
from django import forms from django import forms
from django.contrib.postgres.forms import SimpleArrayField from django.contrib.postgres.forms import SimpleArrayField
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from utilities.data import ranges_to_string, string_to_range_array from utilities.data import ranges_to_string, string_to_range_array
@ -37,9 +38,8 @@ class NumericRangeArrayField(forms.CharField):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
if not self.help_text: if not self.help_text:
self.help_text = _( self.help_text = mark_safe(
"Specify one or more numeric ranges separated by commas " _("Specify one or more numeric ranges separated by commas. Example: " + "<code>1-5,20-30</code>")
"Example: <code>1-5,20-30</code>"
) )
def clean(self, value): def clean(self, value):