Update help_texts for models, import forms

This commit is contained in:
Jeremy Stretch 2020-05-01 15:40:34 -04:00
parent 3536882d4a
commit 1cc2659557
10 changed files with 118 additions and 150 deletions

View File

@ -55,12 +55,6 @@ class ProviderCSVForm(CustomFieldModelCSVForm):
class Meta: class Meta:
model = Provider model = Provider
fields = Provider.csv_headers fields = Provider.csv_headers
help_texts = {
'name': 'Provider name',
'asn': '32-bit autonomous system number',
'portal_url': 'Portal URL',
'comments': 'Free-form comments',
}
class ProviderBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditForm): class ProviderBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditForm):
@ -195,7 +189,7 @@ class CircuitCSVForm(CustomFieldModelCSVForm):
provider = forms.ModelChoiceField( provider = forms.ModelChoiceField(
queryset=Provider.objects.all(), queryset=Provider.objects.all(),
to_field_name='name', to_field_name='name',
help_text='Name of parent provider', help_text='Assigned provider',
error_messages={ error_messages={
'invalid_choice': 'Provider not found.' 'invalid_choice': 'Provider not found.'
} }
@ -217,7 +211,7 @@ class CircuitCSVForm(CustomFieldModelCSVForm):
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Name of assigned tenant', help_text='Assigned tenant',
error_messages={ error_messages={
'invalid_choice': 'Tenant not found.' 'invalid_choice': 'Tenant not found.'
} }

View File

@ -38,7 +38,8 @@ class Provider(ChangeLoggedModel, CustomFieldModel):
asn = ASNField( asn = ASNField(
blank=True, blank=True,
null=True, null=True,
verbose_name='ASN' verbose_name='ASN',
help_text='32-bit autonomous system number'
) )
account = models.CharField( account = models.CharField(
max_length=30, max_length=30,
@ -47,7 +48,7 @@ class Provider(ChangeLoggedModel, CustomFieldModel):
) )
portal_url = models.URLField( portal_url = models.URLField(
blank=True, blank=True,
verbose_name='Portal' verbose_name='Portal URL'
) )
noc_contact = models.TextField( noc_contact = models.TextField(
blank=True, blank=True,

View File

@ -5,6 +5,7 @@ from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.contrib.postgres.forms.array import SimpleArrayField from django.contrib.postgres.forms.array import SimpleArrayField
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.utils.safestring import mark_safe
from mptt.forms import TreeNodeChoiceField from mptt.forms import TreeNodeChoiceField
from netaddr import EUI from netaddr import EUI
from netaddr.core import AddrFormatError from netaddr.core import AddrFormatError
@ -206,10 +207,6 @@ class RegionCSVForm(forms.ModelForm):
class Meta: class Meta:
model = Region model = Region
fields = Region.csv_headers fields = Region.csv_headers
help_texts = {
'name': 'Region name',
'slug': 'URL-friendly slug',
}
class RegionFilterForm(BootstrapMixin, forms.Form): class RegionFilterForm(BootstrapMixin, forms.Form):
@ -280,7 +277,7 @@ class SiteCSVForm(CustomFieldModelCSVForm):
queryset=Region.objects.all(), queryset=Region.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Name of assigned region', help_text='Assigned region',
error_messages={ error_messages={
'invalid_choice': 'Region not found.', 'invalid_choice': 'Region not found.',
} }
@ -289,7 +286,7 @@ class SiteCSVForm(CustomFieldModelCSVForm):
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Name of assigned tenant', help_text='Assigned tenant',
error_messages={ error_messages={
'invalid_choice': 'Tenant not found.', 'invalid_choice': 'Tenant not found.',
} }
@ -299,9 +296,9 @@ class SiteCSVForm(CustomFieldModelCSVForm):
model = Site model = Site
fields = Site.csv_headers fields = Site.csv_headers
help_texts = { help_texts = {
'name': 'Site name', 'time_zone': mark_safe(
'slug': 'URL-friendly slug', 'Time zone (<a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">available options</a>)'
'asn': '32-bit autonomous system number', )
} }
@ -395,7 +392,7 @@ class RackGroupCSVForm(forms.ModelForm):
site = forms.ModelChoiceField( site = forms.ModelChoiceField(
queryset=Site.objects.all(), queryset=Site.objects.all(),
to_field_name='name', to_field_name='name',
help_text='Name of parent site', help_text='Assigned site',
error_messages={ error_messages={
'invalid_choice': 'Site not found.', 'invalid_choice': 'Site not found.',
} }
@ -404,7 +401,7 @@ class RackGroupCSVForm(forms.ModelForm):
queryset=RackGroup.objects.all(), queryset=RackGroup.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Name of parent rack group', help_text='Parent rack group',
error_messages={ error_messages={
'invalid_choice': 'Rack group not found.', 'invalid_choice': 'Rack group not found.',
} }
@ -413,10 +410,6 @@ class RackGroupCSVForm(forms.ModelForm):
class Meta: class Meta:
model = RackGroup model = RackGroup
fields = RackGroup.csv_headers fields = RackGroup.csv_headers
help_texts = {
'name': 'Name of rack group',
'slug': 'URL-friendly slug',
}
class RackGroupFilterForm(BootstrapMixin, forms.Form): class RackGroupFilterForm(BootstrapMixin, forms.Form):
@ -475,8 +468,7 @@ class RackRoleCSVForm(forms.ModelForm):
model = RackRole model = RackRole
fields = RackRole.csv_headers fields = RackRole.csv_headers
help_texts = { help_texts = {
'name': 'Name of rack role', 'color': mark_safe('RGB color in hexadecimal (e.g. <code>00ff00</code>)'),
'color': 'RGB color in hexadecimal (e.g. 00ff00)'
} }
@ -530,13 +522,11 @@ class RackCSVForm(CustomFieldModelCSVForm):
site = forms.ModelChoiceField( site = forms.ModelChoiceField(
queryset=Site.objects.all(), queryset=Site.objects.all(),
to_field_name='name', to_field_name='name',
help_text='Name of parent site',
error_messages={ error_messages={
'invalid_choice': 'Site not found.', 'invalid_choice': 'Site not found.',
} }
) )
group_name = forms.CharField( group_name = forms.CharField(
help_text='Name of rack group',
required=False required=False
) )
tenant = forms.ModelChoiceField( tenant = forms.ModelChoiceField(
@ -580,10 +570,6 @@ class RackCSVForm(CustomFieldModelCSVForm):
class Meta: class Meta:
model = Rack model = Rack
fields = Rack.csv_headers fields = Rack.csv_headers
help_texts = {
'name': 'Rack name',
'u_height': 'Height in rack units',
}
def clean(self): def clean(self):
@ -832,7 +818,7 @@ class RackReservationCSVForm(forms.ModelForm):
site = forms.ModelChoiceField( site = forms.ModelChoiceField(
queryset=Site.objects.all(), queryset=Site.objects.all(),
to_field_name='name', to_field_name='name',
help_text='Name of parent site', help_text='Parent site',
error_messages={ error_messages={
'invalid_choice': 'Invalid site name.', 'invalid_choice': 'Invalid site name.',
} }
@ -853,7 +839,7 @@ class RackReservationCSVForm(forms.ModelForm):
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Name of assigned tenant', help_text='Assigned tenant',
error_messages={ error_messages={
'invalid_choice': 'Tenant not found.', 'invalid_choice': 'Tenant not found.',
} }
@ -862,8 +848,6 @@ class RackReservationCSVForm(forms.ModelForm):
class Meta: class Meta:
model = RackReservation model = RackReservation
fields = ('site', 'rack_group', 'rack_name', 'units', 'tenant', 'description') fields = ('site', 'rack_group', 'rack_name', 'units', 'tenant', 'description')
help_texts = {
}
def clean(self): def clean(self):
@ -954,10 +938,6 @@ class ManufacturerCSVForm(forms.ModelForm):
class Meta: class Meta:
model = Manufacturer model = Manufacturer
fields = Manufacturer.csv_headers fields = Manufacturer.csv_headers
help_texts = {
'name': 'Manufacturer name',
'slug': 'URL-friendly slug',
}
# #
@ -1675,8 +1655,7 @@ class DeviceRoleCSVForm(forms.ModelForm):
model = DeviceRole model = DeviceRole
fields = DeviceRole.csv_headers fields = DeviceRole.csv_headers
help_texts = { help_texts = {
'name': 'Name of device role', 'color': mark_safe('RGB color in hexadecimal (e.g. <code>00ff00</code>)'),
'color': 'RGB color in hexadecimal (e.g. 00ff00)'
} }
@ -1709,7 +1688,7 @@ class PlatformCSVForm(forms.ModelForm):
queryset=Manufacturer.objects.all(), queryset=Manufacturer.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Manufacturer name', help_text='Limit platform assignments to this manufacturer',
error_messages={ error_messages={
'invalid_choice': 'Manufacturer not found.', 'invalid_choice': 'Manufacturer not found.',
} }
@ -1718,9 +1697,6 @@ class PlatformCSVForm(forms.ModelForm):
class Meta: class Meta:
model = Platform model = Platform
fields = Platform.csv_headers fields = Platform.csv_headers
help_texts = {
'name': 'Platform name',
}
# #
@ -1925,7 +1901,7 @@ class BaseDeviceCSVForm(CustomFieldModelCSVForm):
device_role = forms.ModelChoiceField( device_role = forms.ModelChoiceField(
queryset=DeviceRole.objects.all(), queryset=DeviceRole.objects.all(),
to_field_name='name', to_field_name='name',
help_text='Name of assigned role', help_text='Assigned role',
error_messages={ error_messages={
'invalid_choice': 'Invalid device role.', 'invalid_choice': 'Invalid device role.',
} }
@ -1934,7 +1910,7 @@ class BaseDeviceCSVForm(CustomFieldModelCSVForm):
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Name of assigned tenant', help_text='Assigned tenant',
error_messages={ error_messages={
'invalid_choice': 'Tenant not found.', 'invalid_choice': 'Tenant not found.',
} }
@ -1954,7 +1930,7 @@ class BaseDeviceCSVForm(CustomFieldModelCSVForm):
queryset=Platform.objects.all(), queryset=Platform.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Name of assigned platform', help_text='Assigned platform',
error_messages={ error_messages={
'invalid_choice': 'Invalid platform.', 'invalid_choice': 'Invalid platform.',
} }
@ -1963,13 +1939,19 @@ class BaseDeviceCSVForm(CustomFieldModelCSVForm):
choices=DeviceStatusChoices, choices=DeviceStatusChoices,
help_text='Operational status' help_text='Operational status'
) )
cluster = forms.ModelChoiceField(
queryset=Cluster.objects.all(),
to_field_name='name',
required=False,
help_text='Virtualization cluster',
error_messages={
'invalid_choice': 'Invalid cluster name.',
}
)
class Meta: class Meta:
fields = [] fields = []
model = Device model = Device
help_texts = {
'name': 'Device name',
}
def clean(self): def clean(self):
@ -1990,14 +1972,14 @@ class DeviceCSVForm(BaseDeviceCSVForm):
site = forms.ModelChoiceField( site = forms.ModelChoiceField(
queryset=Site.objects.all(), queryset=Site.objects.all(),
to_field_name='name', to_field_name='name',
help_text='Name of parent site', help_text='Assigned site',
error_messages={ error_messages={
'invalid_choice': 'Invalid site name.', 'invalid_choice': 'Invalid site name.',
} }
) )
rack_group = forms.CharField( rack_group = forms.CharField(
required=False, required=False,
help_text='Parent rack\'s group (if any)' help_text='Assigned rack\'s group (if any)'
) )
rack_name = forms.CharField( rack_name = forms.CharField(
required=False, required=False,
@ -2008,15 +1990,6 @@ class DeviceCSVForm(BaseDeviceCSVForm):
required=False, required=False,
help_text='Mounted rack face' help_text='Mounted rack face'
) )
cluster = forms.ModelChoiceField(
queryset=Cluster.objects.all(),
to_field_name='name',
required=False,
help_text='Virtualization cluster',
error_messages={
'invalid_choice': 'Invalid cluster name.',
}
)
class Meta(BaseDeviceCSVForm.Meta): class Meta(BaseDeviceCSVForm.Meta):
fields = [ fields = [
@ -2057,15 +2030,6 @@ class ChildDeviceCSVForm(BaseDeviceCSVForm):
device_bay_name = forms.CharField( device_bay_name = forms.CharField(
help_text='Name of device bay', help_text='Name of device bay',
) )
cluster = forms.ModelChoiceField(
queryset=Cluster.objects.all(),
to_field_name='name',
required=False,
help_text='Virtualization cluster',
error_messages={
'invalid_choice': 'Invalid cluster name.',
}
)
class Meta(BaseDeviceCSVForm.Meta): class Meta(BaseDeviceCSVForm.Meta):
fields = [ fields = [
@ -2744,6 +2708,7 @@ class PowerOutletCSVForm(forms.ModelForm):
queryset=PowerPort.objects.all(), queryset=PowerPort.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Local power port which feeds this outlet',
error_messages={ error_messages={
'invalid_choice': 'Power port not found.', 'invalid_choice': 'Power port not found.',
} }
@ -2751,6 +2716,7 @@ class PowerOutletCSVForm(forms.ModelForm):
feed_leg = CSVChoiceField( feed_leg = CSVChoiceField(
choices=PowerOutletFeedLegChoices, choices=PowerOutletFeedLegChoices,
required=False, required=False,
help_text='Electrical phase (for three-phase circuits)'
) )
class Meta: class Meta:
@ -3073,17 +3039,19 @@ class InterfaceCSVForm(forms.ModelForm):
queryset=Interface.objects.all(), queryset=Interface.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='LAG interface', help_text='Parent LAG interface',
error_messages={ error_messages={
'invalid_choice': 'LAG interface not found.', 'invalid_choice': 'LAG interface not found.',
} }
) )
type = CSVChoiceField( type = CSVChoiceField(
choices=InterfaceTypeChoices, choices=InterfaceTypeChoices,
help_text='Physical medium'
) )
mode = CSVChoiceField( mode = CSVChoiceField(
choices=InterfaceModeChoices, choices=InterfaceModeChoices,
required=False, required=False,
help_text='IEEE 802.1Q operational mode (for L2 interfaces)'
) )
class Meta: class Meta:
@ -3274,17 +3242,22 @@ class FrontPortCSVForm(forms.ModelForm):
rear_port = forms.ModelChoiceField( rear_port = forms.ModelChoiceField(
queryset=RearPort.objects.all(), queryset=RearPort.objects.all(),
to_field_name='name', to_field_name='name',
help_text='Corresponding rear port',
error_messages={ error_messages={
'invalid_choice': 'Rear Port not found.', 'invalid_choice': 'Rear Port not found.',
} }
) )
type = CSVChoiceField( type = CSVChoiceField(
choices=PortTypeChoices, choices=PortTypeChoices,
help_text='Physical medium classification'
) )
class Meta: class Meta:
model = FrontPort model = FrontPort
fields = FrontPort.csv_headers fields = FrontPort.csv_headers
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)
@ -3408,12 +3381,16 @@ class RearPortCSVForm(forms.ModelForm):
} }
) )
type = CSVChoiceField( type = CSVChoiceField(
help_text='Physical medium classification',
choices=PortTypeChoices, choices=PortTypeChoices,
) )
class Meta: class Meta:
model = RearPort model = RearPort
fields = RearPort.csv_headers fields = RearPort.csv_headers
help_texts = {
'positions': 'Number of front ports which may be mapped'
}
# #
@ -3518,6 +3495,7 @@ class DeviceBayCSVForm(forms.ModelForm):
queryset=Device.objects.all(), queryset=Device.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Child device installed within this bay',
error_messages={ error_messages={
'invalid_choice': 'Child device not found.', 'invalid_choice': 'Child device not found.',
} }
@ -3797,7 +3775,6 @@ class CableForm(BootstrapMixin, forms.ModelForm):
class CableCSVForm(forms.ModelForm): class CableCSVForm(forms.ModelForm):
# Termination A # Termination A
side_a_device = forms.ModelChoiceField( side_a_device = forms.ModelChoiceField(
queryset=Device.objects.all(), queryset=Device.objects.all(),
@ -3814,7 +3791,7 @@ class CableCSVForm(forms.ModelForm):
help_text='Side A type' help_text='Side A type'
) )
side_a_name = forms.CharField( side_a_name = forms.CharField(
help_text='Side A component' help_text='Side A component name'
) )
# Termination B # Termination B
@ -3833,7 +3810,7 @@ class CableCSVForm(forms.ModelForm):
help_text='Side B type' help_text='Side B type'
) )
side_b_name = forms.CharField( side_b_name = forms.CharField(
help_text='Side B component' help_text='Side B component name'
) )
# Cable attributes # Cable attributes
@ -3845,7 +3822,7 @@ class CableCSVForm(forms.ModelForm):
type = CSVChoiceField( type = CSVChoiceField(
choices=CableTypeChoices, choices=CableTypeChoices,
required=False, required=False,
help_text='Cable type' help_text='Physical medium classification'
) )
length_unit = CSVChoiceField( length_unit = CSVChoiceField(
choices=CableLengthUnitChoices, choices=CableLengthUnitChoices,
@ -3860,7 +3837,7 @@ class CableCSVForm(forms.ModelForm):
'status', 'label', 'color', 'length', 'length_unit', 'status', 'label', 'color', 'length', 'length_unit',
] ]
help_texts = { help_texts = {
'color': 'RGB color in hexadecimal (e.g. 00ff00)' 'color': mark_safe('RGB color in hexadecimal (e.g. <code>00ff00</code>)'),
} }
# TODO: Merge the clean() methods for either end # TODO: Merge the clean() methods for either end
@ -4163,7 +4140,6 @@ class InventoryItemCSVForm(forms.ModelForm):
queryset=Manufacturer.objects.all(), queryset=Manufacturer.objects.all(),
to_field_name='name', to_field_name='name',
required=False, required=False,
help_text='Manufacturer name',
error_messages={ error_messages={
'invalid_choice': 'Invalid manufacturer.', 'invalid_choice': 'Invalid manufacturer.',
} }
@ -4614,7 +4590,7 @@ class PowerFeedCSVForm(CustomFieldModelCSVForm):
site = forms.ModelChoiceField( site = forms.ModelChoiceField(
queryset=Site.objects.all(), queryset=Site.objects.all(),
to_field_name='name', to_field_name='name',
help_text='Name of parent site', help_text='Assigned site',
error_messages={ error_messages={
'invalid_choice': 'Site not found.', 'invalid_choice': 'Site not found.',
} }
@ -4622,18 +4598,18 @@ class PowerFeedCSVForm(CustomFieldModelCSVForm):
panel_name = forms.ModelChoiceField( panel_name = forms.ModelChoiceField(
queryset=PowerPanel.objects.all(), queryset=PowerPanel.objects.all(),
to_field_name='name', to_field_name='name',
help_text='Name of upstream power panel', help_text='Upstream power panel',
error_messages={ error_messages={
'invalid_choice': 'Power panel not found.', 'invalid_choice': 'Power panel not found.',
} }
) )
rack_group = forms.CharField( rack_group = forms.CharField(
required=False, required=False,
help_text="Rack group name (optional)" help_text="Assigned rack's group name"
) )
rack_name = forms.CharField( rack_name = forms.CharField(
required=False, required=False,
help_text="Rack name (optional)" help_text="Assigned rack name"
) )
status = CSVChoiceField( status = CSVChoiceField(
choices=PowerFeedStatusChoices, choices=PowerFeedStatusChoices,
@ -4648,7 +4624,7 @@ class PowerFeedCSVForm(CustomFieldModelCSVForm):
supply = CSVChoiceField( supply = CSVChoiceField(
choices=PowerFeedSupplyChoices, choices=PowerFeedSupplyChoices,
required=False, required=False,
help_text='AC/DC' help_text='Supply type (AC/DC)'
) )
phase = CSVChoiceField( phase = CSVChoiceField(
choices=PowerFeedPhaseChoices, choices=PowerFeedPhaseChoices,

View File

@ -179,12 +179,14 @@ class Site(ChangeLoggedModel, CustomFieldModel):
) )
facility = models.CharField( facility = models.CharField(
max_length=50, max_length=50,
blank=True blank=True,
help_text='Local facility ID or description'
) )
asn = ASNField( asn = ASNField(
blank=True, blank=True,
null=True, null=True,
verbose_name='ASN' verbose_name='ASN',
help_text='32-bit autonomous system number'
) )
time_zone = TimeZoneField( time_zone = TimeZoneField(
blank=True blank=True
@ -205,13 +207,15 @@ class Site(ChangeLoggedModel, CustomFieldModel):
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)'
) )
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)'
) )
contact_name = models.CharField( contact_name = models.CharField(
max_length=50, max_length=50,
@ -418,7 +422,8 @@ class Rack(ChangeLoggedModel, CustomFieldModel):
max_length=50, max_length=50,
blank=True, blank=True,
null=True, null=True,
verbose_name='Facility ID' verbose_name='Facility ID',
help_text='Locally-assigned identifier'
) )
site = models.ForeignKey( site = models.ForeignKey(
to='dcim.Site', to='dcim.Site',
@ -430,7 +435,8 @@ class Rack(ChangeLoggedModel, CustomFieldModel):
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
related_name='racks', related_name='racks',
blank=True, blank=True,
null=True null=True,
help_text='Assigned group'
) )
tenant = models.ForeignKey( tenant = models.ForeignKey(
to='tenancy.Tenant', to='tenancy.Tenant',
@ -449,7 +455,8 @@ class Rack(ChangeLoggedModel, CustomFieldModel):
on_delete=models.PROTECT, on_delete=models.PROTECT,
related_name='racks', related_name='racks',
blank=True, blank=True,
null=True null=True,
help_text='Functional role'
) )
serial = models.CharField( serial = models.CharField(
max_length=50, max_length=50,
@ -479,7 +486,8 @@ class Rack(ChangeLoggedModel, CustomFieldModel):
u_height = models.PositiveSmallIntegerField( u_height = models.PositiveSmallIntegerField(
default=RACK_U_HEIGHT_DEFAULT, default=RACK_U_HEIGHT_DEFAULT,
verbose_name='Height (U)', verbose_name='Height (U)',
validators=[MinValueValidator(1), MaxValueValidator(100)] validators=[MinValueValidator(1), MaxValueValidator(100)],
help_text='Height in rack units'
) )
desc_units = models.BooleanField( desc_units = models.BooleanField(
default=False, default=False,
@ -488,11 +496,13 @@ class Rack(ChangeLoggedModel, CustomFieldModel):
) )
outer_width = models.PositiveSmallIntegerField( outer_width = models.PositiveSmallIntegerField(
blank=True, blank=True,
null=True null=True,
help_text='Outer dimension of rack (width)'
) )
outer_depth = models.PositiveSmallIntegerField( outer_depth = models.PositiveSmallIntegerField(
blank=True, blank=True,
null=True null=True,
help_text='Outer dimension of rack (depth)'
) )
outer_unit = models.CharField( outer_unit = models.CharField(
max_length=50, max_length=50,

View File

@ -239,7 +239,8 @@ class ConsolePort(CableTermination, ComponentModel):
type = models.CharField( type = models.CharField(
max_length=50, max_length=50,
choices=ConsolePortTypeChoices, choices=ConsolePortTypeChoices,
blank=True blank=True,
help_text='Physical port type'
) )
connected_endpoint = models.OneToOneField( connected_endpoint = models.OneToOneField(
to='dcim.ConsoleServerPort', to='dcim.ConsoleServerPort',
@ -300,7 +301,8 @@ class ConsoleServerPort(CableTermination, ComponentModel):
type = models.CharField( type = models.CharField(
max_length=50, max_length=50,
choices=ConsolePortTypeChoices, choices=ConsolePortTypeChoices,
blank=True blank=True,
help_text='Physical port type'
) )
connection_status = models.NullBooleanField( connection_status = models.NullBooleanField(
choices=CONNECTION_STATUS_CHOICES, choices=CONNECTION_STATUS_CHOICES,
@ -354,7 +356,8 @@ class PowerPort(CableTermination, ComponentModel):
type = models.CharField( type = models.CharField(
max_length=50, max_length=50,
choices=PowerPortTypeChoices, choices=PowerPortTypeChoices,
blank=True blank=True,
help_text='Physical port type'
) )
maximum_draw = models.PositiveSmallIntegerField( maximum_draw = models.PositiveSmallIntegerField(
blank=True, blank=True,
@ -516,7 +519,8 @@ class PowerOutlet(CableTermination, ComponentModel):
type = models.CharField( type = models.CharField(
max_length=50, max_length=50,
choices=PowerOutletTypeChoices, choices=PowerOutletTypeChoices,
blank=True blank=True,
help_text='Physical port type'
) )
power_port = models.ForeignKey( power_port = models.ForeignKey(
to='dcim.PowerPort', to='dcim.PowerPort',
@ -653,7 +657,7 @@ class Interface(CableTermination, ComponentModel):
mode = models.CharField( mode = models.CharField(
max_length=50, max_length=50,
choices=InterfaceModeChoices, choices=InterfaceModeChoices,
blank=True, blank=True
) )
untagged_vlan = models.ForeignKey( untagged_vlan = models.ForeignKey(
to='ipam.VLAN', to='ipam.VLAN',
@ -1083,7 +1087,8 @@ class InventoryItem(ComponentModel):
part_id = models.CharField( part_id = models.CharField(
max_length=50, max_length=50,
verbose_name='Part ID', verbose_name='Part ID',
blank=True blank=True,
help_text='Manufacturer-assigned part identifier'
) )
serial = models.CharField( serial = models.CharField(
max_length=50, max_length=50,
@ -1100,7 +1105,7 @@ class InventoryItem(ComponentModel):
) )
discovered = models.BooleanField( discovered = models.BooleanField(
default=False, default=False,
verbose_name='Discovered' help_text='This item was automatically discovered'
) )
tags = TaggableManager(through=TaggedItem) tags = TaggableManager(through=TaggedItem)

View File

@ -55,7 +55,7 @@ class VRFCSVForm(CustomFieldModelCSVForm):
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Name of assigned tenant', help_text='Assigned tenant',
error_messages={ error_messages={
'invalid_choice': 'Tenant not found.', 'invalid_choice': 'Tenant not found.',
} }
@ -64,9 +64,6 @@ class VRFCSVForm(CustomFieldModelCSVForm):
class Meta: class Meta:
model = VRF model = VRF
fields = VRF.csv_headers fields = VRF.csv_headers
help_texts = {
'name': 'VRF name',
}
class VRFBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditForm): class VRFBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditForm):
@ -169,7 +166,7 @@ class AggregateCSVForm(CustomFieldModelCSVForm):
rir = forms.ModelChoiceField( rir = forms.ModelChoiceField(
queryset=RIR.objects.all(), queryset=RIR.objects.all(),
to_field_name='name', to_field_name='name',
help_text='Name of parent RIR', help_text='Assigned RIR',
error_messages={ error_messages={
'invalid_choice': 'RIR not found.', 'invalid_choice': 'RIR not found.',
} }
@ -251,9 +248,6 @@ class RoleCSVForm(forms.ModelForm):
class Meta: class Meta:
model = Role model = Role
fields = Role.csv_headers fields = Role.csv_headers
help_texts = {
'name': 'Role name',
}
# #
@ -335,6 +329,7 @@ class PrefixCSVForm(CustomFieldModelCSVForm):
queryset=VRF.objects.all(), queryset=VRF.objects.all(),
to_field_name='name', to_field_name='name',
required=False, required=False,
help_text='Assigned VRF',
error_messages={ error_messages={
'invalid_choice': 'VRF not found.', 'invalid_choice': 'VRF not found.',
} }
@ -343,7 +338,7 @@ class PrefixCSVForm(CustomFieldModelCSVForm):
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Name of assigned tenant', help_text='Assigned tenant',
error_messages={ error_messages={
'invalid_choice': 'Tenant not found.', 'invalid_choice': 'Tenant not found.',
} }
@ -352,7 +347,7 @@ class PrefixCSVForm(CustomFieldModelCSVForm):
queryset=Site.objects.all(), queryset=Site.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Name of parent site', help_text='Assigned site',
error_messages={ error_messages={
'invalid_choice': 'Site not found.', 'invalid_choice': 'Site not found.',
} }
@ -738,6 +733,7 @@ class IPAddressCSVForm(CustomFieldModelCSVForm):
queryset=VRF.objects.all(), queryset=VRF.objects.all(),
to_field_name='name', to_field_name='name',
required=False, required=False,
help_text='Assigned VRF',
error_messages={ error_messages={
'invalid_choice': 'VRF not found.', 'invalid_choice': 'VRF not found.',
} }
@ -746,7 +742,7 @@ class IPAddressCSVForm(CustomFieldModelCSVForm):
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
to_field_name='name', to_field_name='name',
required=False, required=False,
help_text='Name of the assigned tenant', help_text='Assigned tenant',
error_messages={ error_messages={
'invalid_choice': 'Tenant not found.', 'invalid_choice': 'Tenant not found.',
} }
@ -994,7 +990,7 @@ class VLANGroupCSVForm(forms.ModelForm):
queryset=Site.objects.all(), queryset=Site.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Name of parent site', help_text='Assigned site',
error_messages={ error_messages={
'invalid_choice': 'Site not found.', 'invalid_choice': 'Site not found.',
} }
@ -1004,9 +1000,6 @@ class VLANGroupCSVForm(forms.ModelForm):
class Meta: class Meta:
model = VLANGroup model = VLANGroup
fields = VLANGroup.csv_headers fields = VLANGroup.csv_headers
help_texts = {
'name': 'Name of VLAN group',
}
class VLANGroupFilterForm(BootstrapMixin, forms.Form): class VLANGroupFilterForm(BootstrapMixin, forms.Form):
@ -1082,7 +1075,7 @@ class VLANCSVForm(CustomFieldModelCSVForm):
queryset=Site.objects.all(), queryset=Site.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Name of parent site', help_text='Assigned site',
error_messages={ error_messages={
'invalid_choice': 'Site not found.', 'invalid_choice': 'Site not found.',
} }
@ -1095,7 +1088,7 @@ class VLANCSVForm(CustomFieldModelCSVForm):
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
to_field_name='name', to_field_name='name',
required=False, required=False,
help_text='Name of assigned tenant', help_text='Assigned tenant',
error_messages={ error_messages={
'invalid_choice': 'Tenant not found.', 'invalid_choice': 'Tenant not found.',
} }
@ -1299,6 +1292,7 @@ class ServiceCSVForm(CustomFieldModelCSVForm):
queryset=Device.objects.all(), queryset=Device.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Required if not assigned to a VM',
error_messages={ error_messages={
'invalid_choice': 'Device not found.', 'invalid_choice': 'Device not found.',
} }
@ -1307,6 +1301,7 @@ class ServiceCSVForm(CustomFieldModelCSVForm):
queryset=VirtualMachine.objects.all(), queryset=VirtualMachine.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Required if not assigned to a device',
error_messages={ error_messages={
'invalid_choice': 'Virtual machine not found.', 'invalid_choice': 'Virtual machine not found.',
} }
@ -1319,8 +1314,6 @@ class ServiceCSVForm(CustomFieldModelCSVForm):
class Meta: class Meta:
model = Service model = Service
fields = Service.csv_headers fields = Service.csv_headers
help_texts = {
}
class ServiceBulkEditForm(BootstrapMixin, CustomFieldBulkEditForm): class ServiceBulkEditForm(BootstrapMixin, CustomFieldBulkEditForm):

View File

@ -50,7 +50,8 @@ class VRF(ChangeLoggedModel, CustomFieldModel):
unique=True, unique=True,
blank=True, blank=True,
null=True, null=True,
verbose_name='Route distinguisher' verbose_name='Route distinguisher',
help_text='Unique route distinguisher (as defined in RFC 4364)'
) )
tenant = models.ForeignKey( tenant = models.ForeignKey(
to='tenancy.Tenant', to='tenancy.Tenant',
@ -1017,7 +1018,10 @@ class Service(ChangeLoggedModel, CustomFieldModel):
choices=ServiceProtocolChoices choices=ServiceProtocolChoices
) )
port = models.PositiveIntegerField( port = models.PositiveIntegerField(
validators=[MinValueValidator(SERVICE_PORT_MIN), MaxValueValidator(SERVICE_PORT_MAX)], validators=[
MinValueValidator(SERVICE_PORT_MIN),
MaxValueValidator(SERVICE_PORT_MAX)
],
verbose_name='Port number' verbose_name='Port number'
) )
ipaddresses = models.ManyToManyField( ipaddresses = models.ManyToManyField(

View File

@ -61,9 +61,6 @@ class SecretRoleCSVForm(forms.ModelForm):
class Meta: class Meta:
model = SecretRole model = SecretRole
fields = SecretRole.csv_headers fields = SecretRole.csv_headers
help_texts = {
'name': 'Name of secret role',
}
# #
@ -123,6 +120,7 @@ class SecretCSVForm(CustomFieldModelCSVForm):
device = forms.ModelChoiceField( device = forms.ModelChoiceField(
queryset=Device.objects.all(), queryset=Device.objects.all(),
to_field_name='name', to_field_name='name',
help_text='Assigned device',
error_messages={ error_messages={
'invalid_choice': 'Device not found.', 'invalid_choice': 'Device not found.',
} }
@ -130,7 +128,7 @@ class SecretCSVForm(CustomFieldModelCSVForm):
role = forms.ModelChoiceField( role = forms.ModelChoiceField(
queryset=SecretRole.objects.all(), queryset=SecretRole.objects.all(),
to_field_name='name', to_field_name='name',
help_text='Name of assigned role', help_text='Assigned role',
error_messages={ error_messages={
'invalid_choice': 'Invalid secret role.', 'invalid_choice': 'Invalid secret role.',
} }

View File

@ -37,7 +37,7 @@ class TenantGroupCSVForm(forms.ModelForm):
queryset=TenantGroup.objects.all(), queryset=TenantGroup.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Name of parent tenant group', help_text='Parent group',
error_messages={ error_messages={
'invalid_choice': 'Tenant group not found.', 'invalid_choice': 'Tenant group not found.',
} }
@ -47,9 +47,6 @@ class TenantGroupCSVForm(forms.ModelForm):
class Meta: class Meta:
model = TenantGroup model = TenantGroup
fields = TenantGroup.csv_headers fields = TenantGroup.csv_headers
help_texts = {
'name': 'Group name',
}
# #
@ -80,7 +77,7 @@ class TenantCSVForm(CustomFieldModelForm):
queryset=TenantGroup.objects.all(), queryset=TenantGroup.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Name of parent group', help_text='Assigned group',
error_messages={ error_messages={
'invalid_choice': 'Group not found.' 'invalid_choice': 'Group not found.'
} }
@ -89,10 +86,6 @@ class TenantCSVForm(CustomFieldModelForm):
class Meta: class Meta:
model = Tenant model = Tenant
fields = Tenant.csv_headers fields = Tenant.csv_headers
help_texts = {
'name': 'Tenant name',
'comments': 'Free-form comments'
}
class TenantBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditForm): class TenantBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditForm):

View File

@ -42,9 +42,6 @@ class ClusterTypeCSVForm(forms.ModelForm):
class Meta: class Meta:
model = ClusterType model = ClusterType
fields = ClusterType.csv_headers fields = ClusterType.csv_headers
help_texts = {
'name': 'Name of cluster type',
}
# #
@ -67,9 +64,6 @@ class ClusterGroupCSVForm(forms.ModelForm):
class Meta: class Meta:
model = ClusterGroup model = ClusterGroup
fields = ClusterGroup.csv_headers fields = ClusterGroup.csv_headers
help_texts = {
'name': 'Name of cluster group',
}
# #
@ -104,7 +98,7 @@ class ClusterCSVForm(CustomFieldModelCSVForm):
type = forms.ModelChoiceField( type = forms.ModelChoiceField(
queryset=ClusterType.objects.all(), queryset=ClusterType.objects.all(),
to_field_name='name', to_field_name='name',
help_text='Name of cluster type', help_text='Type of cluster',
error_messages={ error_messages={
'invalid_choice': 'Invalid cluster type name.', 'invalid_choice': 'Invalid cluster type name.',
} }
@ -113,7 +107,7 @@ class ClusterCSVForm(CustomFieldModelCSVForm):
queryset=ClusterGroup.objects.all(), queryset=ClusterGroup.objects.all(),
to_field_name='name', to_field_name='name',
required=False, required=False,
help_text='Name of cluster group', help_text='Assigned cluster group',
error_messages={ error_messages={
'invalid_choice': 'Invalid cluster group name.', 'invalid_choice': 'Invalid cluster group name.',
} }
@ -122,7 +116,7 @@ class ClusterCSVForm(CustomFieldModelCSVForm):
queryset=Site.objects.all(), queryset=Site.objects.all(),
to_field_name='name', to_field_name='name',
required=False, required=False,
help_text='Name of assigned site', help_text='Assigned site',
error_messages={ error_messages={
'invalid_choice': 'Invalid site name.', 'invalid_choice': 'Invalid site name.',
} }
@ -131,7 +125,7 @@ class ClusterCSVForm(CustomFieldModelCSVForm):
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
to_field_name='name', to_field_name='name',
required=False, required=False,
help_text='Name of assigned tenant', help_text='Assigned tenant',
error_messages={ error_messages={
'invalid_choice': 'Invalid tenant name' 'invalid_choice': 'Invalid tenant name'
} }
@ -410,7 +404,7 @@ class VirtualMachineCSVForm(CustomFieldModelCSVForm):
cluster = forms.ModelChoiceField( cluster = forms.ModelChoiceField(
queryset=Cluster.objects.all(), queryset=Cluster.objects.all(),
to_field_name='name', to_field_name='name',
help_text='Name of parent cluster', help_text='Assigned cluster',
error_messages={ error_messages={
'invalid_choice': 'Invalid cluster name.', 'invalid_choice': 'Invalid cluster name.',
} }
@ -421,7 +415,7 @@ class VirtualMachineCSVForm(CustomFieldModelCSVForm):
), ),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Name of functional role', help_text='Functional role',
error_messages={ error_messages={
'invalid_choice': 'Invalid role name.' 'invalid_choice': 'Invalid role name.'
} }
@ -430,7 +424,7 @@ class VirtualMachineCSVForm(CustomFieldModelCSVForm):
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Name of assigned tenant', help_text='Assigned tenant',
error_messages={ error_messages={
'invalid_choice': 'Tenant not found.' 'invalid_choice': 'Tenant not found.'
} }
@ -439,7 +433,7 @@ class VirtualMachineCSVForm(CustomFieldModelCSVForm):
queryset=Platform.objects.all(), queryset=Platform.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text='Name of assigned platform', help_text='Assigned platform',
error_messages={ error_messages={
'invalid_choice': 'Invalid platform.', 'invalid_choice': 'Invalid platform.',
} }