mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #11325: Move help_texts from model forms to models
This commit is contained in:
@@ -394,10 +394,6 @@ class BaseDeviceImportForm(NetBoxModelImportForm):
|
||||
class Meta:
|
||||
fields = []
|
||||
model = Device
|
||||
help_texts = {
|
||||
'vc_position': 'Virtual chassis position',
|
||||
'vc_priority': 'Virtual chassis priority',
|
||||
}
|
||||
|
||||
def __init__(self, data=None, *args, **kwargs):
|
||||
super().__init__(data, *args, **kwargs)
|
||||
@@ -775,9 +771,6 @@ class FrontPortImportForm(NetBoxModelImportForm):
|
||||
'device', 'name', 'label', 'type', 'color', 'mark_connected', 'rear_port', 'rear_port_position',
|
||||
'description', 'tags'
|
||||
)
|
||||
help_texts = {
|
||||
'rear_port_position': _('Mapped position on corresponding rear port'),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
@@ -815,9 +808,6 @@ class RearPortImportForm(NetBoxModelImportForm):
|
||||
class Meta:
|
||||
model = RearPort
|
||||
fields = ('device', 'name', 'label', 'type', 'color', 'mark_connected', 'positions', 'description', 'tags')
|
||||
help_texts = {
|
||||
'positions': _('Number of front ports which may be mapped')
|
||||
}
|
||||
|
||||
|
||||
class ModuleBayImportForm(NetBoxModelImportForm):
|
||||
@@ -1204,4 +1194,3 @@ class VirtualDeviceContextImportForm(NetBoxModelImportForm):
|
||||
'name', 'device', 'status', 'tenant', 'identifier', 'comments',
|
||||
]
|
||||
model = VirtualDeviceContext
|
||||
help_texts = {}
|
||||
|
||||
@@ -66,12 +66,6 @@ __all__ = (
|
||||
'VirtualDeviceContextForm'
|
||||
)
|
||||
|
||||
INTERFACE_MODE_HELP_TEXT = """
|
||||
Access: One untagged VLAN<br />
|
||||
Tagged: One untagged VLAN and/or one or more tagged VLANs<br />
|
||||
Tagged (All): Implies all VLANs are available (w/optional untagged VLAN)
|
||||
"""
|
||||
|
||||
|
||||
class RegionForm(NetBoxModelForm):
|
||||
parent = DynamicModelChoiceField(
|
||||
@@ -160,16 +154,6 @@ class SiteForm(TenancyForm, NetBoxModelForm):
|
||||
}
|
||||
),
|
||||
}
|
||||
help_texts = {
|
||||
'name': _("Full name of the site"),
|
||||
'facility': _("Data center provider and facility (e.g. Equinix NY7)"),
|
||||
'time_zone': _("Local time zone"),
|
||||
'description': _("Short description (will appear in sites list)"),
|
||||
'physical_address': _("Physical location of the building (e.g. for GPS)"),
|
||||
'shipping_address': _("If different from the physical address"),
|
||||
'latitude': _("Latitude in decimal format (xx.yyyyyy)"),
|
||||
'longitude': _("Longitude in decimal format (xx.yyyyyy)")
|
||||
}
|
||||
|
||||
|
||||
class LocationForm(TenancyForm, NetBoxModelForm):
|
||||
@@ -276,12 +260,6 @@ class RackForm(TenancyForm, NetBoxModelForm):
|
||||
'role', 'serial', 'asset_tag', 'type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth',
|
||||
'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'description', 'comments', 'tags',
|
||||
]
|
||||
help_texts = {
|
||||
'site': _("The site at which the rack exists"),
|
||||
'name': _("Organizational rack name"),
|
||||
'facility_id': _("The unique rack ID assigned by the facility"),
|
||||
'u_height': _("Height in rack units"),
|
||||
}
|
||||
|
||||
|
||||
class RackReservationForm(TenancyForm, NetBoxModelForm):
|
||||
@@ -583,12 +561,6 @@ class DeviceForm(TenancyForm, NetBoxModelForm):
|
||||
'cluster_group', 'cluster', 'tenant_group', 'tenant', 'virtual_chassis', 'vc_position', 'vc_priority',
|
||||
'description', 'config_template', 'comments', 'tags', 'local_context_data'
|
||||
]
|
||||
help_texts = {
|
||||
'device_role': _("The function this device serves"),
|
||||
'serial': _("Chassis serial number"),
|
||||
'local_context_data': _("Local config context data overwrites all source contexts in the final rendered "
|
||||
"config context"),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
@@ -1374,11 +1346,6 @@ class InterfaceForm(InterfaceCommonForm, ModularDeviceComponentForm):
|
||||
labels = {
|
||||
'mode': '802.1Q Mode',
|
||||
}
|
||||
help_texts = {
|
||||
'mode': INTERFACE_MODE_HELP_TEXT,
|
||||
'rf_channel_frequency': _("Populated by selected channel (if set)"),
|
||||
'rf_channel_width': _("Populated by selected channel (if set)"),
|
||||
}
|
||||
|
||||
|
||||
class FrontPortForm(ModularDeviceComponentForm):
|
||||
|
||||
@@ -478,7 +478,8 @@ class BaseInterface(models.Model):
|
||||
mode = models.CharField(
|
||||
max_length=50,
|
||||
choices=InterfaceModeChoices,
|
||||
blank=True
|
||||
blank=True,
|
||||
help_text=_("IEEE 802.1Q tagging strategy")
|
||||
)
|
||||
parent = models.ForeignKey(
|
||||
to='self',
|
||||
@@ -587,14 +588,16 @@ class Interface(ModularComponentModel, BaseInterface, CabledObjectModel, PathEnd
|
||||
decimal_places=2,
|
||||
blank=True,
|
||||
null=True,
|
||||
verbose_name='Channel frequency (MHz)'
|
||||
verbose_name='Channel frequency (MHz)',
|
||||
help_text=_("Populated by selected channel (if set)")
|
||||
)
|
||||
rf_channel_width = models.DecimalField(
|
||||
max_digits=7,
|
||||
decimal_places=3,
|
||||
blank=True,
|
||||
null=True,
|
||||
verbose_name='Channel width (MHz)'
|
||||
verbose_name='Channel width (MHz)',
|
||||
help_text=_("Populated by selected channel (if set)")
|
||||
)
|
||||
tx_power = models.PositiveSmallIntegerField(
|
||||
blank=True,
|
||||
@@ -885,7 +888,8 @@ class FrontPort(ModularComponentModel, CabledObjectModel):
|
||||
validators=[
|
||||
MinValueValidator(REARPORT_POSITIONS_MIN),
|
||||
MaxValueValidator(REARPORT_POSITIONS_MAX)
|
||||
]
|
||||
],
|
||||
help_text=_('Mapped position on corresponding rear port')
|
||||
)
|
||||
|
||||
clone_fields = ('device', 'type', 'color')
|
||||
@@ -940,7 +944,8 @@ class RearPort(ModularComponentModel, CabledObjectModel):
|
||||
validators=[
|
||||
MinValueValidator(REARPORT_POSITIONS_MIN),
|
||||
MaxValueValidator(REARPORT_POSITIONS_MAX)
|
||||
]
|
||||
],
|
||||
help_text=_('Number of front ports which may be mapped')
|
||||
)
|
||||
clone_fields = ('device', 'type', 'color', 'positions')
|
||||
|
||||
|
||||
@@ -480,7 +480,8 @@ class Device(PrimaryModel, ConfigContextModel):
|
||||
device_role = models.ForeignKey(
|
||||
to='dcim.DeviceRole',
|
||||
on_delete=models.PROTECT,
|
||||
related_name='devices'
|
||||
related_name='devices',
|
||||
help_text=_("The function this device serves")
|
||||
)
|
||||
tenant = models.ForeignKey(
|
||||
to='tenancy.Tenant',
|
||||
@@ -510,7 +511,8 @@ class Device(PrimaryModel, ConfigContextModel):
|
||||
serial = models.CharField(
|
||||
max_length=50,
|
||||
blank=True,
|
||||
verbose_name='Serial number'
|
||||
verbose_name='Serial number',
|
||||
help_text=_("Chassis serial number, assigned by the manufacturer")
|
||||
)
|
||||
asset_tag = models.CharField(
|
||||
max_length=50,
|
||||
@@ -597,12 +599,14 @@ class Device(PrimaryModel, ConfigContextModel):
|
||||
vc_position = models.PositiveSmallIntegerField(
|
||||
blank=True,
|
||||
null=True,
|
||||
validators=[MaxValueValidator(255)]
|
||||
validators=[MaxValueValidator(255)],
|
||||
help_text=_('Virtual chassis position')
|
||||
)
|
||||
vc_priority = models.PositiveSmallIntegerField(
|
||||
blank=True,
|
||||
null=True,
|
||||
validators=[MaxValueValidator(255)]
|
||||
validators=[MaxValueValidator(255)],
|
||||
help_text=_('Virtual chassis master election priority')
|
||||
)
|
||||
config_template = models.ForeignKey(
|
||||
to='extras.ConfigTemplate',
|
||||
|
||||
@@ -64,7 +64,7 @@ class Rack(PrimaryModel, WeightMixin):
|
||||
blank=True,
|
||||
null=True,
|
||||
verbose_name='Facility ID',
|
||||
help_text=_('Locally-assigned identifier')
|
||||
help_text=_("Locally-assigned identifier")
|
||||
)
|
||||
site = models.ForeignKey(
|
||||
to='dcim.Site',
|
||||
|
||||
@@ -139,7 +139,8 @@ class Site(PrimaryModel):
|
||||
"""
|
||||
name = models.CharField(
|
||||
max_length=100,
|
||||
unique=True
|
||||
unique=True,
|
||||
help_text=_("Full name of the site")
|
||||
)
|
||||
_name = NaturalOrderingField(
|
||||
target_field='name',
|
||||
@@ -179,7 +180,7 @@ class Site(PrimaryModel):
|
||||
facility = models.CharField(
|
||||
max_length=50,
|
||||
blank=True,
|
||||
help_text=_('Local facility ID or description')
|
||||
help_text=_("Local facility ID or description")
|
||||
)
|
||||
asns = models.ManyToManyField(
|
||||
to='ipam.ASN',
|
||||
@@ -191,25 +192,27 @@ class Site(PrimaryModel):
|
||||
)
|
||||
physical_address = models.CharField(
|
||||
max_length=200,
|
||||
blank=True
|
||||
blank=True,
|
||||
help_text=_("Physical location of the building")
|
||||
)
|
||||
shipping_address = models.CharField(
|
||||
max_length=200,
|
||||
blank=True
|
||||
blank=True,
|
||||
help_text=_("If different from the physical address")
|
||||
)
|
||||
latitude = models.DecimalField(
|
||||
max_digits=8,
|
||||
decimal_places=6,
|
||||
blank=True,
|
||||
null=True,
|
||||
help_text=_('GPS coordinate (latitude)')
|
||||
help_text=_("GPS coordinate in decimal format (xx.yyyyyy)")
|
||||
)
|
||||
longitude = models.DecimalField(
|
||||
max_digits=9,
|
||||
decimal_places=6,
|
||||
blank=True,
|
||||
null=True,
|
||||
help_text=_('GPS coordinate (longitude)')
|
||||
help_text=_("GPS coordinate in decimal format (xx.yyyyyy)")
|
||||
)
|
||||
|
||||
# Generic relations
|
||||
|
||||
Reference in New Issue
Block a user