Closes #11325: Move help_texts from model forms to models

This commit is contained in:
jeremystretch
2023-03-01 17:31:54 -05:00
parent 536b46158a
commit c44eb65993
19 changed files with 75 additions and 134 deletions

View File

@@ -47,9 +47,6 @@ class CircuitTypeImportForm(NetBoxModelImportForm):
class Meta:
model = CircuitType
fields = ('name', 'slug', 'description', 'tags')
help_texts = {
'name': _('Name of circuit type'),
}
class CircuitImportForm(NetBoxModelImportForm):

View File

@@ -37,9 +37,6 @@ class ProviderForm(NetBoxModelForm):
fields = [
'name', 'slug', 'account', 'asns', 'description', 'comments', 'tags',
]
help_texts = {
'name': _("Full name of the provider"),
}
class ProviderNetworkForm(NetBoxModelForm):
@@ -96,10 +93,6 @@ class CircuitForm(TenancyForm, NetBoxModelForm):
'cid', 'type', 'provider', 'status', 'install_date', 'termination_date', 'commit_rate', 'description',
'tenant_group', 'tenant', 'comments', 'tags',
]
help_texts = {
'cid': _("Unique circuit ID"),
'commit_rate': _("Committed rate"),
}
widgets = {
'install_date': DatePicker(),
'termination_date': DatePicker(),
@@ -166,11 +159,6 @@ class CircuitTerminationForm(NetBoxModelForm):
'provider_network', 'mark_connected', 'port_speed', 'upstream_speed', 'xconnect_id', 'pp_info',
'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 = {
'port_speed': SelectSpeedWidget(),
'upstream_speed': SelectSpeedWidget(),

View File

@@ -34,7 +34,8 @@ class Circuit(PrimaryModel):
"""
cid = models.CharField(
max_length=100,
verbose_name='Circuit ID'
verbose_name='Circuit ID',
help_text=_("Unique circuit ID")
)
provider = models.ForeignKey(
to='circuits.Provider',
@@ -71,7 +72,9 @@ class Circuit(PrimaryModel):
commit_rate = models.PositiveIntegerField(
blank=True,
null=True,
verbose_name='Commit rate (Kbps)')
verbose_name='Commit rate (Kbps)',
help_text=_("Committed rate")
)
# Generic relations
contacts = GenericRelation(
@@ -160,7 +163,8 @@ class CircuitTermination(
port_speed = models.PositiveIntegerField(
verbose_name='Port speed (Kbps)',
blank=True,
null=True
null=True,
help_text=_("Physical circuit speed")
)
upstream_speed = models.PositiveIntegerField(
blank=True,
@@ -171,12 +175,14 @@ class CircuitTermination(
xconnect_id = models.CharField(
max_length=50,
blank=True,
verbose_name='Cross-connect ID'
verbose_name='Cross-connect ID',
help_text=_("ID of the local cross-connect")
)
pp_info = models.CharField(
max_length=100,
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(
max_length=200,

View File

@@ -1,6 +1,7 @@
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
from django.urls import reverse
from django.utils.translation import gettext as _
from netbox.models import PrimaryModel
@@ -17,7 +18,8 @@ class Provider(PrimaryModel):
"""
name = models.CharField(
max_length=100,
unique=True
unique=True,
help_text=_("Full name of the provider")
)
slug = models.SlugField(
max_length=100,