Standardize "MAC Address" instead of "MAC"

This commit is contained in:
Brian Tiemann 2024-11-14 15:54:04 -05:00
parent 3d244bfa37
commit 944eadaf95
4 changed files with 7 additions and 7 deletions

View File

@ -724,7 +724,7 @@ class MACAddressImportForm(NetBoxModelImportForm):
) )
is_primary = forms.BooleanField( is_primary = forms.BooleanField(
label=_('Is primary'), label=_('Is primary'),
help_text=_('Make this the primary MAC for the assigned interface'), help_text=_('Make this the primary MAC address for the assigned interface'),
required=False required=False
) )
@ -764,11 +764,11 @@ class MACAddressImportForm(NetBoxModelImportForm):
# TODO: scope to interface rather than device/VM # TODO: scope to interface rather than device/VM
if is_primary and not device and not virtual_machine: if is_primary and not device and not virtual_machine:
raise forms.ValidationError({ raise forms.ValidationError({
"is_primary": _("No device or virtual machine specified; cannot set as primary MAC") "is_primary": _("No device or virtual machine specified; cannot set as primary")
}) })
if is_primary and not interface: if is_primary and not interface:
raise forms.ValidationError({ raise forms.ValidationError({
"is_primary": _("No interface specified; cannot set as primary MAC") "is_primary": _("No interface specified; cannot set as primary")
}) })
def save(self, *args, **kwargs): def save(self, *args, **kwargs):

View File

@ -938,13 +938,13 @@ class MACAddressForm(NetBoxModelForm):
assigned_object = self.cleaned_data[selected_objects[0]] assigned_object = self.cleaned_data[selected_objects[0]]
if self.instance.pk and self.instance.assigned_object and self.instance.is_primary and assigned_object != self.instance.assigned_object: if self.instance.pk and self.instance.assigned_object and self.instance.is_primary and assigned_object != self.instance.assigned_object:
raise ValidationError( raise ValidationError(
_("Cannot reassign MAC address while it is designated as the primary MAC for the interface") _("Cannot reassign MAC address while it is designated as the primary for the interface")
) )
self.instance.assigned_object = assigned_object self.instance.assigned_object = assigned_object
else: else:
self.instance.assigned_object = None self.instance.assigned_object = None
# Primary MAC assignment is only available if an interface has been assigned. # Primary MAC address assignment is only available if an interface has been assigned.
interface = self.cleaned_data.get('interface') or self.cleaned_data.get('vminterface') interface = self.cleaned_data.get('interface') or self.cleaned_data.get('vminterface')
if self.cleaned_data.get('is_primary') and not interface: if self.cleaned_data.get('is_primary') and not interface:
self.add_error( self.add_error(

View File

@ -609,7 +609,7 @@ class MACAddressTable(NetBoxTable):
verbose_name=_('Interface') verbose_name=_('Interface')
) )
is_primary = columns.BooleanColumn( is_primary = columns.BooleanColumn(
verbose_name=_('Primary MAC'), verbose_name=_('Primary for Interface'),
false_mark=None false_mark=None
) )
assigned_device = tables.Column( assigned_device = tables.Column(

View File

@ -28,7 +28,7 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">{% trans "Primary MAC for Interface" %}</th> <th scope="row">{% trans "Primary MAC address for Interface" %}</th>
<td>{% checkmark object.is_primary %}</td> <td>{% checkmark object.is_primary %}</td>
</tr> </tr>
</table> </table>