mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 04:02:52 -06:00
Closes #11325: Move help_texts from model forms to models
This commit is contained in:
parent
536b46158a
commit
c44eb65993
@ -47,9 +47,6 @@ class CircuitTypeImportForm(NetBoxModelImportForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = CircuitType
|
model = CircuitType
|
||||||
fields = ('name', 'slug', 'description', 'tags')
|
fields = ('name', 'slug', 'description', 'tags')
|
||||||
help_texts = {
|
|
||||||
'name': _('Name of circuit type'),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class CircuitImportForm(NetBoxModelImportForm):
|
class CircuitImportForm(NetBoxModelImportForm):
|
||||||
|
@ -37,9 +37,6 @@ class ProviderForm(NetBoxModelForm):
|
|||||||
fields = [
|
fields = [
|
||||||
'name', 'slug', 'account', 'asns', 'description', 'comments', 'tags',
|
'name', 'slug', 'account', 'asns', 'description', 'comments', 'tags',
|
||||||
]
|
]
|
||||||
help_texts = {
|
|
||||||
'name': _("Full name of the provider"),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class ProviderNetworkForm(NetBoxModelForm):
|
class ProviderNetworkForm(NetBoxModelForm):
|
||||||
@ -96,10 +93,6 @@ class CircuitForm(TenancyForm, NetBoxModelForm):
|
|||||||
'cid', 'type', 'provider', 'status', 'install_date', 'termination_date', 'commit_rate', 'description',
|
'cid', 'type', 'provider', 'status', 'install_date', 'termination_date', 'commit_rate', 'description',
|
||||||
'tenant_group', 'tenant', 'comments', 'tags',
|
'tenant_group', 'tenant', 'comments', 'tags',
|
||||||
]
|
]
|
||||||
help_texts = {
|
|
||||||
'cid': _("Unique circuit ID"),
|
|
||||||
'commit_rate': _("Committed rate"),
|
|
||||||
}
|
|
||||||
widgets = {
|
widgets = {
|
||||||
'install_date': DatePicker(),
|
'install_date': DatePicker(),
|
||||||
'termination_date': DatePicker(),
|
'termination_date': DatePicker(),
|
||||||
@ -166,11 +159,6 @@ class CircuitTerminationForm(NetBoxModelForm):
|
|||||||
'provider_network', 'mark_connected', 'port_speed', 'upstream_speed', 'xconnect_id', 'pp_info',
|
'provider_network', 'mark_connected', 'port_speed', 'upstream_speed', 'xconnect_id', 'pp_info',
|
||||||
'description', 'tags',
|
'description', 'tags',
|
||||||
]
|
]
|
||||||
help_texts = {
|
|
||||||
'port_speed': _("Physical circuit speed"),
|
|
||||||
'xconnect_id': _("ID of the local cross-connect"),
|
|
||||||
'pp_info': _("Patch panel ID and port number(s)")
|
|
||||||
}
|
|
||||||
widgets = {
|
widgets = {
|
||||||
'port_speed': SelectSpeedWidget(),
|
'port_speed': SelectSpeedWidget(),
|
||||||
'upstream_speed': SelectSpeedWidget(),
|
'upstream_speed': SelectSpeedWidget(),
|
||||||
|
@ -34,7 +34,8 @@ class Circuit(PrimaryModel):
|
|||||||
"""
|
"""
|
||||||
cid = models.CharField(
|
cid = models.CharField(
|
||||||
max_length=100,
|
max_length=100,
|
||||||
verbose_name='Circuit ID'
|
verbose_name='Circuit ID',
|
||||||
|
help_text=_("Unique circuit ID")
|
||||||
)
|
)
|
||||||
provider = models.ForeignKey(
|
provider = models.ForeignKey(
|
||||||
to='circuits.Provider',
|
to='circuits.Provider',
|
||||||
@ -71,7 +72,9 @@ class Circuit(PrimaryModel):
|
|||||||
commit_rate = models.PositiveIntegerField(
|
commit_rate = models.PositiveIntegerField(
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
verbose_name='Commit rate (Kbps)')
|
verbose_name='Commit rate (Kbps)',
|
||||||
|
help_text=_("Committed rate")
|
||||||
|
)
|
||||||
|
|
||||||
# Generic relations
|
# Generic relations
|
||||||
contacts = GenericRelation(
|
contacts = GenericRelation(
|
||||||
@ -160,7 +163,8 @@ class CircuitTermination(
|
|||||||
port_speed = models.PositiveIntegerField(
|
port_speed = models.PositiveIntegerField(
|
||||||
verbose_name='Port speed (Kbps)',
|
verbose_name='Port speed (Kbps)',
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True
|
null=True,
|
||||||
|
help_text=_("Physical circuit speed")
|
||||||
)
|
)
|
||||||
upstream_speed = models.PositiveIntegerField(
|
upstream_speed = models.PositiveIntegerField(
|
||||||
blank=True,
|
blank=True,
|
||||||
@ -171,12 +175,14 @@ class CircuitTermination(
|
|||||||
xconnect_id = models.CharField(
|
xconnect_id = models.CharField(
|
||||||
max_length=50,
|
max_length=50,
|
||||||
blank=True,
|
blank=True,
|
||||||
verbose_name='Cross-connect ID'
|
verbose_name='Cross-connect ID',
|
||||||
|
help_text=_("ID of the local cross-connect")
|
||||||
)
|
)
|
||||||
pp_info = models.CharField(
|
pp_info = models.CharField(
|
||||||
max_length=100,
|
max_length=100,
|
||||||
blank=True,
|
blank=True,
|
||||||
verbose_name='Patch panel/port(s)'
|
verbose_name='Patch panel/port(s)',
|
||||||
|
help_text=_("Patch panel ID and port number(s)")
|
||||||
)
|
)
|
||||||
description = models.CharField(
|
description = models.CharField(
|
||||||
max_length=200,
|
max_length=200,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from django.contrib.contenttypes.fields import GenericRelation
|
from django.contrib.contenttypes.fields import GenericRelation
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from netbox.models import PrimaryModel
|
from netbox.models import PrimaryModel
|
||||||
|
|
||||||
@ -17,7 +18,8 @@ class Provider(PrimaryModel):
|
|||||||
"""
|
"""
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
max_length=100,
|
max_length=100,
|
||||||
unique=True
|
unique=True,
|
||||||
|
help_text=_("Full name of the provider")
|
||||||
)
|
)
|
||||||
slug = models.SlugField(
|
slug = models.SlugField(
|
||||||
max_length=100,
|
max_length=100,
|
||||||
|
@ -394,10 +394,6 @@ class BaseDeviceImportForm(NetBoxModelImportForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
fields = []
|
fields = []
|
||||||
model = Device
|
model = Device
|
||||||
help_texts = {
|
|
||||||
'vc_position': 'Virtual chassis position',
|
|
||||||
'vc_priority': 'Virtual chassis priority',
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self, data=None, *args, **kwargs):
|
def __init__(self, data=None, *args, **kwargs):
|
||||||
super().__init__(data, *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',
|
'device', 'name', 'label', 'type', 'color', 'mark_connected', 'rear_port', 'rear_port_position',
|
||||||
'description', 'tags'
|
'description', 'tags'
|
||||||
)
|
)
|
||||||
help_texts = {
|
|
||||||
'rear_port_position': _('Mapped position on corresponding rear port'),
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
@ -815,9 +808,6 @@ class RearPortImportForm(NetBoxModelImportForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = RearPort
|
model = RearPort
|
||||||
fields = ('device', 'name', 'label', 'type', 'color', 'mark_connected', 'positions', 'description', 'tags')
|
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):
|
class ModuleBayImportForm(NetBoxModelImportForm):
|
||||||
@ -1204,4 +1194,3 @@ class VirtualDeviceContextImportForm(NetBoxModelImportForm):
|
|||||||
'name', 'device', 'status', 'tenant', 'identifier', 'comments',
|
'name', 'device', 'status', 'tenant', 'identifier', 'comments',
|
||||||
]
|
]
|
||||||
model = VirtualDeviceContext
|
model = VirtualDeviceContext
|
||||||
help_texts = {}
|
|
||||||
|
@ -66,12 +66,6 @@ __all__ = (
|
|||||||
'VirtualDeviceContextForm'
|
'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):
|
class RegionForm(NetBoxModelForm):
|
||||||
parent = DynamicModelChoiceField(
|
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):
|
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',
|
'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',
|
'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):
|
class RackReservationForm(TenancyForm, NetBoxModelForm):
|
||||||
@ -583,12 +561,6 @@ class DeviceForm(TenancyForm, NetBoxModelForm):
|
|||||||
'cluster_group', 'cluster', 'tenant_group', 'tenant', 'virtual_chassis', 'vc_position', 'vc_priority',
|
'cluster_group', 'cluster', 'tenant_group', 'tenant', 'virtual_chassis', 'vc_position', 'vc_priority',
|
||||||
'description', 'config_template', 'comments', 'tags', 'local_context_data'
|
'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):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
@ -1374,11 +1346,6 @@ class InterfaceForm(InterfaceCommonForm, ModularDeviceComponentForm):
|
|||||||
labels = {
|
labels = {
|
||||||
'mode': '802.1Q Mode',
|
'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):
|
class FrontPortForm(ModularDeviceComponentForm):
|
||||||
|
@ -478,7 +478,8 @@ class BaseInterface(models.Model):
|
|||||||
mode = models.CharField(
|
mode = models.CharField(
|
||||||
max_length=50,
|
max_length=50,
|
||||||
choices=InterfaceModeChoices,
|
choices=InterfaceModeChoices,
|
||||||
blank=True
|
blank=True,
|
||||||
|
help_text=_("IEEE 802.1Q tagging strategy")
|
||||||
)
|
)
|
||||||
parent = models.ForeignKey(
|
parent = models.ForeignKey(
|
||||||
to='self',
|
to='self',
|
||||||
@ -587,14 +588,16 @@ class Interface(ModularComponentModel, BaseInterface, CabledObjectModel, PathEnd
|
|||||||
decimal_places=2,
|
decimal_places=2,
|
||||||
blank=True,
|
blank=True,
|
||||||
null=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(
|
rf_channel_width = models.DecimalField(
|
||||||
max_digits=7,
|
max_digits=7,
|
||||||
decimal_places=3,
|
decimal_places=3,
|
||||||
blank=True,
|
blank=True,
|
||||||
null=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(
|
tx_power = models.PositiveSmallIntegerField(
|
||||||
blank=True,
|
blank=True,
|
||||||
@ -885,7 +888,8 @@ class FrontPort(ModularComponentModel, CabledObjectModel):
|
|||||||
validators=[
|
validators=[
|
||||||
MinValueValidator(REARPORT_POSITIONS_MIN),
|
MinValueValidator(REARPORT_POSITIONS_MIN),
|
||||||
MaxValueValidator(REARPORT_POSITIONS_MAX)
|
MaxValueValidator(REARPORT_POSITIONS_MAX)
|
||||||
]
|
],
|
||||||
|
help_text=_('Mapped position on corresponding rear port')
|
||||||
)
|
)
|
||||||
|
|
||||||
clone_fields = ('device', 'type', 'color')
|
clone_fields = ('device', 'type', 'color')
|
||||||
@ -940,7 +944,8 @@ class RearPort(ModularComponentModel, CabledObjectModel):
|
|||||||
validators=[
|
validators=[
|
||||||
MinValueValidator(REARPORT_POSITIONS_MIN),
|
MinValueValidator(REARPORT_POSITIONS_MIN),
|
||||||
MaxValueValidator(REARPORT_POSITIONS_MAX)
|
MaxValueValidator(REARPORT_POSITIONS_MAX)
|
||||||
]
|
],
|
||||||
|
help_text=_('Number of front ports which may be mapped')
|
||||||
)
|
)
|
||||||
clone_fields = ('device', 'type', 'color', 'positions')
|
clone_fields = ('device', 'type', 'color', 'positions')
|
||||||
|
|
||||||
|
@ -480,7 +480,8 @@ class Device(PrimaryModel, ConfigContextModel):
|
|||||||
device_role = models.ForeignKey(
|
device_role = models.ForeignKey(
|
||||||
to='dcim.DeviceRole',
|
to='dcim.DeviceRole',
|
||||||
on_delete=models.PROTECT,
|
on_delete=models.PROTECT,
|
||||||
related_name='devices'
|
related_name='devices',
|
||||||
|
help_text=_("The function this device serves")
|
||||||
)
|
)
|
||||||
tenant = models.ForeignKey(
|
tenant = models.ForeignKey(
|
||||||
to='tenancy.Tenant',
|
to='tenancy.Tenant',
|
||||||
@ -510,7 +511,8 @@ class Device(PrimaryModel, ConfigContextModel):
|
|||||||
serial = models.CharField(
|
serial = models.CharField(
|
||||||
max_length=50,
|
max_length=50,
|
||||||
blank=True,
|
blank=True,
|
||||||
verbose_name='Serial number'
|
verbose_name='Serial number',
|
||||||
|
help_text=_("Chassis serial number, assigned by the manufacturer")
|
||||||
)
|
)
|
||||||
asset_tag = models.CharField(
|
asset_tag = models.CharField(
|
||||||
max_length=50,
|
max_length=50,
|
||||||
@ -597,12 +599,14 @@ class Device(PrimaryModel, ConfigContextModel):
|
|||||||
vc_position = models.PositiveSmallIntegerField(
|
vc_position = models.PositiveSmallIntegerField(
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
validators=[MaxValueValidator(255)]
|
validators=[MaxValueValidator(255)],
|
||||||
|
help_text=_('Virtual chassis position')
|
||||||
)
|
)
|
||||||
vc_priority = models.PositiveSmallIntegerField(
|
vc_priority = models.PositiveSmallIntegerField(
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
validators=[MaxValueValidator(255)]
|
validators=[MaxValueValidator(255)],
|
||||||
|
help_text=_('Virtual chassis master election priority')
|
||||||
)
|
)
|
||||||
config_template = models.ForeignKey(
|
config_template = models.ForeignKey(
|
||||||
to='extras.ConfigTemplate',
|
to='extras.ConfigTemplate',
|
||||||
|
@ -64,7 +64,7 @@ class Rack(PrimaryModel, WeightMixin):
|
|||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
verbose_name='Facility ID',
|
verbose_name='Facility ID',
|
||||||
help_text=_('Locally-assigned identifier')
|
help_text=_("Locally-assigned identifier")
|
||||||
)
|
)
|
||||||
site = models.ForeignKey(
|
site = models.ForeignKey(
|
||||||
to='dcim.Site',
|
to='dcim.Site',
|
||||||
|
@ -139,7 +139,8 @@ class Site(PrimaryModel):
|
|||||||
"""
|
"""
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
max_length=100,
|
max_length=100,
|
||||||
unique=True
|
unique=True,
|
||||||
|
help_text=_("Full name of the site")
|
||||||
)
|
)
|
||||||
_name = NaturalOrderingField(
|
_name = NaturalOrderingField(
|
||||||
target_field='name',
|
target_field='name',
|
||||||
@ -179,7 +180,7 @@ class Site(PrimaryModel):
|
|||||||
facility = models.CharField(
|
facility = models.CharField(
|
||||||
max_length=50,
|
max_length=50,
|
||||||
blank=True,
|
blank=True,
|
||||||
help_text=_('Local facility ID or description')
|
help_text=_("Local facility ID or description")
|
||||||
)
|
)
|
||||||
asns = models.ManyToManyField(
|
asns = models.ManyToManyField(
|
||||||
to='ipam.ASN',
|
to='ipam.ASN',
|
||||||
@ -191,25 +192,27 @@ class Site(PrimaryModel):
|
|||||||
)
|
)
|
||||||
physical_address = models.CharField(
|
physical_address = models.CharField(
|
||||||
max_length=200,
|
max_length=200,
|
||||||
blank=True
|
blank=True,
|
||||||
|
help_text=_("Physical location of the building")
|
||||||
)
|
)
|
||||||
shipping_address = models.CharField(
|
shipping_address = models.CharField(
|
||||||
max_length=200,
|
max_length=200,
|
||||||
blank=True
|
blank=True,
|
||||||
|
help_text=_("If different from the physical address")
|
||||||
)
|
)
|
||||||
latitude = models.DecimalField(
|
latitude = models.DecimalField(
|
||||||
max_digits=8,
|
max_digits=8,
|
||||||
decimal_places=6,
|
decimal_places=6,
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
help_text=_('GPS coordinate (latitude)')
|
help_text=_("GPS coordinate in decimal format (xx.yyyyyy)")
|
||||||
)
|
)
|
||||||
longitude = models.DecimalField(
|
longitude = models.DecimalField(
|
||||||
max_digits=9,
|
max_digits=9,
|
||||||
decimal_places=6,
|
decimal_places=6,
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
help_text=_('GPS coordinate (longitude)')
|
help_text=_("GPS coordinate in decimal format (xx.yyyyyy)")
|
||||||
)
|
)
|
||||||
|
|
||||||
# Generic relations
|
# Generic relations
|
||||||
|
@ -56,8 +56,10 @@ class CustomFieldForm(BootstrapMixin, forms.ModelForm):
|
|||||||
model = CustomField
|
model = CustomField
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
help_texts = {
|
help_texts = {
|
||||||
'type': _("The type of data stored in this field. For object/multi-object fields, select the related object "
|
'type': _(
|
||||||
"type below.")
|
"The type of data stored in this field. For object/multi-object fields, select the related object "
|
||||||
|
"type below."
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -80,9 +82,11 @@ class CustomLinkForm(BootstrapMixin, forms.ModelForm):
|
|||||||
'link_url': forms.Textarea(attrs={'class': 'font-monospace'}),
|
'link_url': forms.Textarea(attrs={'class': 'font-monospace'}),
|
||||||
}
|
}
|
||||||
help_texts = {
|
help_texts = {
|
||||||
'link_text': _('Jinja2 template code for the link text. Reference the object as <code>{{ object }}</code>. '
|
'link_text': _(
|
||||||
'Links which render as empty text will not be displayed.'),
|
"Jinja2 template code for the link text. Reference the object as <code>{{ object }}</code>. Links "
|
||||||
'link_url': _('Jinja2 template code for the link URL. Reference the object as <code>{{ object }}</code>.'),
|
"which render as empty text will not be displayed."
|
||||||
|
),
|
||||||
|
'link_url': _("Jinja2 template code for the link URL. Reference the object as <code>{{ object }}</code>."),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -152,6 +152,9 @@ class ConfigContextModel(models.Model):
|
|||||||
local_context_data = models.JSONField(
|
local_context_data = models.JSONField(
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
|
help_text=_(
|
||||||
|
"Local config context data takes precedence over source contexts in the final rendered config context"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -65,9 +65,6 @@ class RIRImportForm(NetBoxModelImportForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = RIR
|
model = RIR
|
||||||
fields = ('name', 'slug', 'is_private', 'description', 'tags')
|
fields = ('name', 'slug', 'is_private', 'description', 'tags')
|
||||||
help_texts = {
|
|
||||||
'name': _('RIR name'),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class AggregateImportForm(NetBoxModelImportForm):
|
class AggregateImportForm(NetBoxModelImportForm):
|
||||||
@ -410,10 +407,6 @@ class VLANImportForm(NetBoxModelImportForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = VLAN
|
model = VLAN
|
||||||
fields = ('site', 'group', 'vid', 'name', 'tenant', 'status', 'role', 'description', 'comments', 'tags')
|
fields = ('site', 'group', 'vid', 'name', 'tenant', 'status', 'role', 'description', 'comments', 'tags')
|
||||||
help_texts = {
|
|
||||||
'vid': 'Numeric VLAN ID (1-4094)',
|
|
||||||
'name': 'VLAN name',
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class ServiceTemplateImportForm(NetBoxModelImportForm):
|
class ServiceTemplateImportForm(NetBoxModelImportForm):
|
||||||
|
@ -68,9 +68,6 @@ class VRFForm(TenancyForm, NetBoxModelForm):
|
|||||||
labels = {
|
labels = {
|
||||||
'rd': "RD",
|
'rd': "RD",
|
||||||
}
|
}
|
||||||
help_texts = {
|
|
||||||
'rd': _("Route distinguisher in any format"),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class RouteTargetForm(TenancyForm, NetBoxModelForm):
|
class RouteTargetForm(TenancyForm, NetBoxModelForm):
|
||||||
@ -120,10 +117,6 @@ class AggregateForm(TenancyForm, NetBoxModelForm):
|
|||||||
fields = [
|
fields = [
|
||||||
'prefix', 'rir', 'date_added', 'tenant_group', 'tenant', 'description', 'comments', 'tags',
|
'prefix', 'rir', 'date_added', 'tenant_group', 'tenant', 'description', 'comments', 'tags',
|
||||||
]
|
]
|
||||||
help_texts = {
|
|
||||||
'prefix': _("IPv4 or IPv6 network"),
|
|
||||||
'rir': _("Regional Internet Registry responsible for this prefix"),
|
|
||||||
}
|
|
||||||
widgets = {
|
widgets = {
|
||||||
'date_added': DatePicker(),
|
'date_added': DatePicker(),
|
||||||
}
|
}
|
||||||
@ -169,10 +162,6 @@ class ASNForm(TenancyForm, NetBoxModelForm):
|
|||||||
fields = [
|
fields = [
|
||||||
'asn', 'rir', 'sites', 'tenant_group', 'tenant', 'description', 'comments', 'tags'
|
'asn', 'rir', 'sites', 'tenant_group', 'tenant', 'description', 'comments', 'tags'
|
||||||
]
|
]
|
||||||
help_texts = {
|
|
||||||
'asn': _("AS number"),
|
|
||||||
'rir': _("Regional Internet Registry responsible for this prefix"),
|
|
||||||
}
|
|
||||||
widgets = {
|
widgets = {
|
||||||
'date_added': DatePicker(),
|
'date_added': DatePicker(),
|
||||||
}
|
}
|
||||||
@ -788,14 +777,6 @@ class VLANForm(TenancyForm, NetBoxModelForm):
|
|||||||
'site', 'group', 'vid', 'name', 'status', 'role', 'tenant_group', 'tenant', 'description', 'comments',
|
'site', 'group', 'vid', 'name', 'status', 'role', 'tenant_group', 'tenant', 'description', 'comments',
|
||||||
'tags',
|
'tags',
|
||||||
]
|
]
|
||||||
help_texts = {
|
|
||||||
'site': _("Leave blank if this VLAN spans multiple sites"),
|
|
||||||
'group': _("VLAN group (optional)"),
|
|
||||||
'vid': _("Configured VLAN ID"),
|
|
||||||
'name': _("Configured VLAN name"),
|
|
||||||
'status': _("Operational status of this VLAN"),
|
|
||||||
'role': _("The primary function of this VLAN"),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class ServiceTemplateForm(NetBoxModelForm):
|
class ServiceTemplateForm(NetBoxModelForm):
|
||||||
@ -851,10 +832,6 @@ class ServiceForm(NetBoxModelForm):
|
|||||||
fields = [
|
fields = [
|
||||||
'device', 'virtual_machine', 'name', 'protocol', 'ports', 'ipaddresses', 'description', 'comments', 'tags',
|
'device', 'virtual_machine', 'name', 'protocol', 'ports', 'ipaddresses', 'description', 'comments', 'tags',
|
||||||
]
|
]
|
||||||
help_texts = {
|
|
||||||
'ipaddresses': _("IP address assignment is optional. If no IPs are selected, the service is assumed to be "
|
|
||||||
"reachable via all IPs assigned to the device."),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class ServiceCreateForm(ServiceForm):
|
class ServiceCreateForm(ServiceForm):
|
||||||
|
@ -87,12 +87,13 @@ class ASN(PrimaryModel):
|
|||||||
to='ipam.RIR',
|
to='ipam.RIR',
|
||||||
on_delete=models.PROTECT,
|
on_delete=models.PROTECT,
|
||||||
related_name='asns',
|
related_name='asns',
|
||||||
verbose_name='RIR'
|
verbose_name='RIR',
|
||||||
|
help_text=_("Regional Internet Registry responsible for this AS number space")
|
||||||
)
|
)
|
||||||
asn = ASNField(
|
asn = ASNField(
|
||||||
unique=True,
|
unique=True,
|
||||||
verbose_name='ASN',
|
verbose_name='ASN',
|
||||||
help_text=_('32-bit autonomous system number')
|
help_text=_('16- or 32-bit autonomous system number')
|
||||||
)
|
)
|
||||||
tenant = models.ForeignKey(
|
tenant = models.ForeignKey(
|
||||||
to='tenancy.Tenant',
|
to='tenancy.Tenant',
|
||||||
|
@ -77,12 +77,15 @@ class Aggregate(GetAvailablePrefixesMixin, PrimaryModel):
|
|||||||
An aggregate exists at the root level of the IP address space hierarchy in NetBox. Aggregates are used to organize
|
An aggregate exists at the root level of the IP address space hierarchy in NetBox. Aggregates are used to organize
|
||||||
the hierarchy and track the overall utilization of available address space. Each Aggregate is assigned to a RIR.
|
the hierarchy and track the overall utilization of available address space. Each Aggregate is assigned to a RIR.
|
||||||
"""
|
"""
|
||||||
prefix = IPNetworkField()
|
prefix = IPNetworkField(
|
||||||
|
help_text=_("IPv4 or IPv6 network")
|
||||||
|
)
|
||||||
rir = models.ForeignKey(
|
rir = models.ForeignKey(
|
||||||
to='ipam.RIR',
|
to='ipam.RIR',
|
||||||
on_delete=models.PROTECT,
|
on_delete=models.PROTECT,
|
||||||
related_name='aggregates',
|
related_name='aggregates',
|
||||||
verbose_name='RIR'
|
verbose_name='RIR',
|
||||||
|
help_text=_("Regional Internet Registry responsible for this IP space")
|
||||||
)
|
)
|
||||||
tenant = models.ForeignKey(
|
tenant = models.ForeignKey(
|
||||||
to='tenancy.Tenant',
|
to='tenancy.Tenant',
|
||||||
|
@ -3,6 +3,7 @@ from django.core.exceptions import ValidationError
|
|||||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from ipam.choices import *
|
from ipam.choices import *
|
||||||
from ipam.constants import *
|
from ipam.constants import *
|
||||||
@ -85,7 +86,8 @@ class Service(ServiceBase, PrimaryModel):
|
|||||||
to='ipam.IPAddress',
|
to='ipam.IPAddress',
|
||||||
related_name='services',
|
related_name='services',
|
||||||
blank=True,
|
blank=True,
|
||||||
verbose_name='IP addresses'
|
verbose_name='IP addresses',
|
||||||
|
help_text=_("The specific IP addresses (if any) to which this service is bound")
|
||||||
)
|
)
|
||||||
|
|
||||||
clone_fields = ['protocol', 'ports', 'description', 'device', 'virtual_machine', 'ipaddresses', ]
|
clone_fields = ['protocol', 'ports', 'description', 'device', 'virtual_machine', 'ipaddresses', ]
|
||||||
|
@ -129,21 +129,24 @@ class VLAN(PrimaryModel):
|
|||||||
on_delete=models.PROTECT,
|
on_delete=models.PROTECT,
|
||||||
related_name='vlans',
|
related_name='vlans',
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True
|
null=True,
|
||||||
|
help_text=_("The specific site to which this VLAN is assigned (if any)")
|
||||||
)
|
)
|
||||||
group = models.ForeignKey(
|
group = models.ForeignKey(
|
||||||
to='ipam.VLANGroup',
|
to='ipam.VLANGroup',
|
||||||
on_delete=models.PROTECT,
|
on_delete=models.PROTECT,
|
||||||
related_name='vlans',
|
related_name='vlans',
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True
|
null=True,
|
||||||
|
help_text=_("VLAN group (optional)")
|
||||||
)
|
)
|
||||||
vid = models.PositiveSmallIntegerField(
|
vid = models.PositiveSmallIntegerField(
|
||||||
verbose_name='ID',
|
verbose_name='ID',
|
||||||
validators=(
|
validators=(
|
||||||
MinValueValidator(VLAN_VID_MIN),
|
MinValueValidator(VLAN_VID_MIN),
|
||||||
MaxValueValidator(VLAN_VID_MAX)
|
MaxValueValidator(VLAN_VID_MAX)
|
||||||
)
|
),
|
||||||
|
help_text=_("Numeric VLAN ID (1-4094)")
|
||||||
)
|
)
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
max_length=64
|
max_length=64
|
||||||
@ -158,14 +161,16 @@ class VLAN(PrimaryModel):
|
|||||||
status = models.CharField(
|
status = models.CharField(
|
||||||
max_length=50,
|
max_length=50,
|
||||||
choices=VLANStatusChoices,
|
choices=VLANStatusChoices,
|
||||||
default=VLANStatusChoices.STATUS_ACTIVE
|
default=VLANStatusChoices.STATUS_ACTIVE,
|
||||||
|
help_text=_("Operational status of this VLAN")
|
||||||
)
|
)
|
||||||
role = models.ForeignKey(
|
role = models.ForeignKey(
|
||||||
to='ipam.Role',
|
to='ipam.Role',
|
||||||
on_delete=models.SET_NULL,
|
on_delete=models.SET_NULL,
|
||||||
related_name='vlans',
|
related_name='vlans',
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True
|
null=True,
|
||||||
|
help_text=_("The primary function of this VLAN")
|
||||||
)
|
)
|
||||||
|
|
||||||
l2vpn_terminations = GenericRelation(
|
l2vpn_terminations = GenericRelation(
|
||||||
|
@ -4,7 +4,6 @@ from django.core.exceptions import ValidationError
|
|||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from dcim.forms.common import InterfaceCommonForm
|
from dcim.forms.common import InterfaceCommonForm
|
||||||
from dcim.forms.model_forms import INTERFACE_MODE_HELP_TEXT
|
|
||||||
from dcim.models import Device, DeviceRole, Platform, Rack, Region, Site, SiteGroup
|
from dcim.models import Device, DeviceRole, Platform, Rack, Region, Site, SiteGroup
|
||||||
from ipam.models import IPAddress, VLAN, VLANGroup, VRF
|
from ipam.models import IPAddress, VLAN, VLANGroup, VRF
|
||||||
from netbox.forms import NetBoxModelForm
|
from netbox.forms import NetBoxModelForm
|
||||||
@ -237,10 +236,6 @@ class VirtualMachineForm(TenancyForm, NetBoxModelForm):
|
|||||||
'platform', 'primary_ip4', 'primary_ip6', 'vcpus', 'memory', 'disk', 'description', 'comments', 'tags',
|
'platform', 'primary_ip4', 'primary_ip6', 'vcpus', 'memory', 'disk', 'description', 'comments', 'tags',
|
||||||
'local_context_data',
|
'local_context_data',
|
||||||
]
|
]
|
||||||
help_texts = {
|
|
||||||
'local_context_data': _("Local config context data overwrites all sources contexts in the final rendered "
|
|
||||||
"config context"),
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
@ -358,9 +353,6 @@ class VMInterfaceForm(InterfaceCommonForm, NetBoxModelForm):
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
help_texts = {
|
|
||||||
'mode': INTERFACE_MODE_HELP_TEXT,
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user