Update forms

This commit is contained in:
jeremystretch 2022-11-03 15:36:28 -04:00
parent 3eb68c76c4
commit 2235b9a694
19 changed files with 317 additions and 141 deletions

View File

@ -30,6 +30,10 @@ class ProviderBulkEditForm(NetBoxModelBulkEditForm):
required=False, required=False,
label='Account number' label='Account number'
) )
description = forms.CharField(
max_length=200,
required=False
)
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=SmallTextarea,
label='Comments' label='Comments'
@ -40,7 +44,7 @@ class ProviderBulkEditForm(NetBoxModelBulkEditForm):
(None, ('asns', 'account', )), (None, ('asns', 'account', )),
) )
nullable_fields = ( nullable_fields = (
'asns', 'account', 'comments', 'asns', 'account', 'description', 'comments',
) )

View File

@ -18,7 +18,7 @@ class ProviderCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = Provider model = Provider
fields = ( fields = (
'name', 'slug', 'account', 'comments', 'name', 'slug', 'account', 'description', 'comments',
) )

View File

@ -1,4 +1,3 @@
from django import forms
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from circuits.models import * from circuits.models import *
@ -7,8 +6,8 @@ from ipam.models import ASN
from netbox.forms import NetBoxModelForm from netbox.forms import NetBoxModelForm
from tenancy.forms import TenancyForm from tenancy.forms import TenancyForm
from utilities.forms import ( from utilities.forms import (
BootstrapMixin, CommentField, DatePicker, DynamicModelChoiceField, DynamicModelMultipleChoiceField, CommentField, DatePicker, DynamicModelChoiceField, DynamicModelMultipleChoiceField, SelectSpeedWidget, SlugField,
SelectSpeedWidget, SmallTextarea, SlugField, StaticSelect, StaticSelect,
) )
__all__ = ( __all__ = (
@ -37,7 +36,7 @@ class ProviderForm(NetBoxModelForm):
class Meta: class Meta:
model = Provider model = Provider
fields = [ fields = [
'name', 'slug', 'account', 'asns', 'comments', 'tags', 'name', 'slug', 'account', 'asns', 'description', 'comments', 'tags',
] ]
help_texts = { help_texts = {
'name': "Full name of the provider", 'name': "Full name of the provider",

View File

@ -127,22 +127,26 @@ class SiteBulkEditForm(NetBoxModelBulkEditForm):
required=False, required=False,
label='Contact E-mail' label='Contact E-mail'
) )
description = forms.CharField(
max_length=100,
required=False
)
time_zone = TimeZoneFormField( time_zone = TimeZoneFormField(
choices=add_blank_choice(TimeZoneFormField().choices), choices=add_blank_choice(TimeZoneFormField().choices),
required=False, required=False,
widget=StaticSelect() widget=StaticSelect()
) )
description = forms.CharField(
max_length=200,
required=False
)
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = Site model = Site
fieldsets = ( fieldsets = (
(None, ('status', 'region', 'group', 'tenant', 'asns', 'time_zone', 'description')), (None, ('status', 'region', 'group', 'tenant', 'asns', 'time_zone', 'description')),
) )
nullable_fields = ( nullable_fields = (
'region', 'group', 'tenant', 'asns', 'description', 'time_zone', 'region', 'group', 'tenant', 'asns', 'time_zone', 'description', 'comments',
) )
@ -285,10 +289,6 @@ class RackBulkEditForm(NetBoxModelBulkEditForm):
required=False, required=False,
min_value=1 min_value=1
) )
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
weight = forms.DecimalField( weight = forms.DecimalField(
min_value=0, min_value=0,
required=False required=False
@ -299,10 +299,18 @@ class RackBulkEditForm(NetBoxModelBulkEditForm):
initial='', initial='',
widget=StaticSelect() widget=StaticSelect()
) )
description = forms.CharField(
max_length=200,
required=False
)
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = Rack model = Rack
fieldsets = ( fieldsets = (
('Rack', ('status', 'role', 'tenant', 'serial', 'asset_tag')), ('Rack', ('status', 'role', 'tenant', 'serial', 'asset_tag', 'description')),
('Location', ('region', 'site_group', 'site', 'location')), ('Location', ('region', 'site_group', 'site', 'location')),
('Hardware', ( ('Hardware', (
'type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth',
@ -310,8 +318,8 @@ class RackBulkEditForm(NetBoxModelBulkEditForm):
('Weight', ('weight', 'weight_unit')), ('Weight', ('weight', 'weight_unit')),
) )
nullable_fields = ( nullable_fields = (
'location', 'tenant', 'role', 'serial', 'asset_tag', 'outer_width', 'outer_depth', 'outer_unit', 'comments', 'location', 'tenant', 'role', 'serial', 'asset_tag', 'outer_width', 'outer_depth', 'outer_unit', 'weight',
'weight', 'weight_unit' 'weight_unit', 'description', 'comments',
) )
@ -328,14 +336,19 @@ class RackReservationBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
description = forms.CharField( description = forms.CharField(
max_length=100, max_length=200,
required=False required=False
) )
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = RackReservation model = RackReservation
fieldsets = ( fieldsets = (
(None, ('user', 'tenant', 'description')), (None, ('user', 'tenant', 'description')),
) )
nullable_fields = ('comments',)
class ManufacturerBulkEditForm(NetBoxModelBulkEditForm): class ManufacturerBulkEditForm(NetBoxModelBulkEditForm):
@ -383,13 +396,21 @@ class DeviceTypeBulkEditForm(NetBoxModelBulkEditForm):
initial='', initial='',
widget=StaticSelect() widget=StaticSelect()
) )
description = forms.CharField(
max_length=200,
required=False
)
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = DeviceType model = DeviceType
fieldsets = ( fieldsets = (
('Device Type', ('manufacturer', 'part_number', 'u_height', 'is_full_depth', 'airflow')), ('Device Type', ('manufacturer', 'part_number', 'u_height', 'is_full_depth', 'airflow', 'description')),
('Weight', ('weight', 'weight_unit')), ('Weight', ('weight', 'weight_unit')),
) )
nullable_fields = ('part_number', 'airflow', 'weight', 'weight_unit') nullable_fields = ('part_number', 'airflow', 'weight', 'weight_unit', 'description', 'comments')
class ModuleTypeBulkEditForm(NetBoxModelBulkEditForm): class ModuleTypeBulkEditForm(NetBoxModelBulkEditForm):
@ -410,13 +431,21 @@ class ModuleTypeBulkEditForm(NetBoxModelBulkEditForm):
initial='', initial='',
widget=StaticSelect() widget=StaticSelect()
) )
description = forms.CharField(
max_length=200,
required=False
)
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = ModuleType model = ModuleType
fieldsets = ( fieldsets = (
('Module Type', ('manufacturer', 'part_number')), ('Module Type', ('manufacturer', 'part_number', 'description')),
('Weight', ('weight', 'weight_unit')), ('Weight', ('weight', 'weight_unit')),
) )
nullable_fields = ('part_number', 'weight', 'weight_unit') nullable_fields = ('part_number', 'weight', 'weight_unit', 'description', 'comments')
class DeviceRoleBulkEditForm(NetBoxModelBulkEditForm): class DeviceRoleBulkEditForm(NetBoxModelBulkEditForm):
@ -512,15 +541,23 @@ class DeviceBulkEditForm(NetBoxModelBulkEditForm):
required=False, required=False,
label='Serial Number' label='Serial Number'
) )
description = forms.CharField(
max_length=200,
required=False
)
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = Device model = Device
fieldsets = ( fieldsets = (
('Device', ('device_role', 'status', 'tenant', 'platform')), ('Device', ('device_role', 'status', 'tenant', 'platform', 'description')),
('Location', ('site', 'location')), ('Location', ('site', 'location')),
('Hardware', ('manufacturer', 'device_type', 'airflow', 'serial')), ('Hardware', ('manufacturer', 'device_type', 'airflow', 'serial')),
) )
nullable_fields = ( nullable_fields = (
'location', 'tenant', 'platform', 'serial', 'airflow', 'location', 'tenant', 'platform', 'serial', 'airflow', 'description', 'comments',
) )
@ -541,12 +578,20 @@ class ModuleBulkEditForm(NetBoxModelBulkEditForm):
required=False, required=False,
label='Serial Number' label='Serial Number'
) )
description = forms.CharField(
max_length=200,
required=False
)
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = Module model = Module
fieldsets = ( fieldsets = (
(None, ('manufacturer', 'module_type', 'serial')), (None, ('manufacturer', 'module_type', 'serial', 'description')),
) )
nullable_fields = ('serial',) nullable_fields = ('serial', 'description', 'comments')
class CableBulkEditForm(NetBoxModelBulkEditForm): class CableBulkEditForm(NetBoxModelBulkEditForm):
@ -583,14 +628,22 @@ class CableBulkEditForm(NetBoxModelBulkEditForm):
initial='', initial='',
widget=StaticSelect() widget=StaticSelect()
) )
description = forms.CharField(
max_length=200,
required=False
)
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = Cable model = Cable
fieldsets = ( fieldsets = (
(None, ('type', 'status', 'tenant', 'label')), (None, ('type', 'status', 'tenant', 'label', 'description')),
('Attributes', ('color', 'length', 'length_unit')), ('Attributes', ('color', 'length', 'length_unit')),
) )
nullable_fields = ( nullable_fields = (
'type', 'status', 'tenant', 'label', 'color', 'length', 'type', 'status', 'tenant', 'label', 'color', 'length', 'description', 'comments',
) )
@ -599,12 +652,20 @@ class VirtualChassisBulkEditForm(NetBoxModelBulkEditForm):
max_length=30, max_length=30,
required=False required=False
) )
description = forms.CharField(
max_length=200,
required=False
)
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = VirtualChassis model = VirtualChassis
fieldsets = ( fieldsets = (
(None, ('domain',)), (None, ('domain', 'description')),
) )
nullable_fields = ('domain',) nullable_fields = ('domain', 'description', 'comments')
class PowerPanelBulkEditForm(NetBoxModelBulkEditForm): class PowerPanelBulkEditForm(NetBoxModelBulkEditForm):
@ -637,12 +698,20 @@ class PowerPanelBulkEditForm(NetBoxModelBulkEditForm):
'site_id': '$site' 'site_id': '$site'
} }
) )
description = forms.CharField(
max_length=200,
required=False
)
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = PowerPanel model = PowerPanel
fieldsets = ( fieldsets = (
(None, ('region', 'site_group', 'site', 'location')), (None, ('region', 'site_group', 'site', 'location', 'description')),
) )
nullable_fields = ('location',) nullable_fields = ('location', 'description', 'comments')
class PowerFeedBulkEditForm(NetBoxModelBulkEditForm): class PowerFeedBulkEditForm(NetBoxModelBulkEditForm):
@ -691,6 +760,10 @@ class PowerFeedBulkEditForm(NetBoxModelBulkEditForm):
required=False, required=False,
widget=BulkEditNullBooleanSelect widget=BulkEditNullBooleanSelect
) )
description = forms.CharField(
max_length=200,
required=False
)
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=SmallTextarea,
label='Comments' label='Comments'
@ -698,10 +771,10 @@ class PowerFeedBulkEditForm(NetBoxModelBulkEditForm):
model = PowerFeed model = PowerFeed
fieldsets = ( fieldsets = (
(None, ('power_panel', 'rack', 'status', 'type', 'mark_connected')), (None, ('power_panel', 'rack', 'status', 'type', 'mark_connected', 'description')),
('Power', ('supply', 'phase', 'voltage', 'amperage', 'max_utilization')) ('Power', ('supply', 'phase', 'voltage', 'amperage', 'max_utilization'))
) )
nullable_fields = ('location', 'comments') nullable_fields = ('location', 'description', 'comments')
# #

View File

@ -196,7 +196,8 @@ class RackCSVForm(NetBoxModelCSVForm):
model = Rack model = Rack
fields = ( fields = (
'site', 'location', 'name', 'facility_id', 'tenant', 'status', 'role', 'type', 'serial', 'asset_tag', 'site', 'location', 'name', 'facility_id', 'tenant', 'status', 'role', 'type', 'serial', 'asset_tag',
'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'comments', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth',
'description', 'comments',
) )
def __init__(self, data=None, *args, **kwargs): def __init__(self, data=None, *args, **kwargs):
@ -240,7 +241,7 @@ class RackReservationCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = RackReservation model = RackReservation
fields = ('site', 'location', 'rack', 'units', 'tenant', 'description') fields = ('site', 'location', 'rack', 'units', 'tenant', 'description', 'comments')
def __init__(self, data=None, *args, **kwargs): def __init__(self, data=None, *args, **kwargs):
super().__init__(data, *args, **kwargs) super().__init__(data, *args, **kwargs)
@ -387,7 +388,7 @@ class DeviceCSVForm(BaseDeviceCSVForm):
fields = [ fields = [
'name', 'device_role', 'tenant', 'manufacturer', 'device_type', 'platform', 'serial', 'asset_tag', 'status', 'name', 'device_role', 'tenant', 'manufacturer', 'device_type', 'platform', 'serial', 'asset_tag', 'status',
'site', 'location', 'rack', 'position', 'face', 'airflow', 'virtual_chassis', 'vc_position', 'vc_priority', 'site', 'location', 'rack', 'position', 'face', 'airflow', 'virtual_chassis', 'vc_position', 'vc_priority',
'cluster', 'comments', 'cluster', 'description', 'comments',
] ]
def __init__(self, data=None, *args, **kwargs): def __init__(self, data=None, *args, **kwargs):
@ -424,7 +425,7 @@ class ModuleCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = Module model = Module
fields = ( fields = (
'device', 'module_bay', 'module_type', 'serial', 'asset_tag', 'comments', 'device', 'module_bay', 'module_type', 'serial', 'asset_tag', 'description', 'comments',
) )
def __init__(self, data=None, *args, **kwargs): def __init__(self, data=None, *args, **kwargs):
@ -927,7 +928,7 @@ class CableCSVForm(NetBoxModelCSVForm):
model = Cable model = Cable
fields = [ fields = [
'side_a_device', 'side_a_type', 'side_a_name', 'side_b_device', 'side_b_type', 'side_b_name', 'type', 'side_a_device', 'side_a_type', 'side_a_name', 'side_b_device', 'side_b_type', 'side_b_name', 'type',
'status', 'tenant', 'label', 'color', 'length', 'length_unit', 'status', 'tenant', 'label', 'color', 'length', 'length_unit', 'description', 'comments',
] ]
help_texts = { help_texts = {
'color': mark_safe('RGB color in hexadecimal (e.g. <code>00ff00</code>)'), 'color': mark_safe('RGB color in hexadecimal (e.g. <code>00ff00</code>)'),
@ -984,7 +985,7 @@ class VirtualChassisCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = VirtualChassis model = VirtualChassis
fields = ('name', 'domain', 'master') fields = ('name', 'domain', 'master', 'description')
# #
@ -1005,7 +1006,7 @@ class PowerPanelCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = PowerPanel model = PowerPanel
fields = ('site', 'location', 'name') fields = ('site', 'location', 'name', 'description', 'comments')
def __init__(self, data=None, *args, **kwargs): def __init__(self, data=None, *args, **kwargs):
super().__init__(data, *args, **kwargs) super().__init__(data, *args, **kwargs)
@ -1061,7 +1062,7 @@ class PowerFeedCSVForm(NetBoxModelCSVForm):
model = PowerFeed model = PowerFeed
fields = ( fields = (
'site', 'power_panel', 'location', 'rack', 'name', 'status', 'type', 'mark_connected', 'supply', 'phase', 'site', 'power_panel', 'location', 'rack', 'name', 'status', 'type', 'mark_connected', 'supply', 'phase',
'voltage', 'amperage', 'max_utilization', 'comments', 'voltage', 'amperage', 'max_utilization', 'description', 'comments',
) )
def __init__(self, data=None, *args, **kwargs): def __init__(self, data=None, *args, **kwargs):

View File

@ -342,6 +342,7 @@ class RackReservationForm(TenancyForm, NetBoxModelForm):
), ),
widget=StaticSelect() widget=StaticSelect()
) )
comments = CommentField()
fieldsets = ( fieldsets = (
('Reservation', ('region', 'site_group', 'site', 'location', 'rack', 'units', 'user', 'description', 'tags')), ('Reservation', ('region', 'site_group', 'site', 'location', 'rack', 'units', 'user', 'description', 'tags')),
@ -352,7 +353,7 @@ class RackReservationForm(TenancyForm, NetBoxModelForm):
model = RackReservation model = RackReservation
fields = [ fields = [
'region', 'site_group', 'site', 'location', 'rack', 'units', 'user', 'tenant_group', 'tenant', 'region', 'site_group', 'site', 'location', 'rack', 'units', 'user', 'tenant_group', 'tenant',
'description', 'tags', 'description', 'comments', 'tags',
] ]
@ -396,7 +397,7 @@ class DeviceTypeForm(NetBoxModelForm):
model = DeviceType model = DeviceType
fields = [ fields = [
'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'subdevice_role', 'airflow', 'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'subdevice_role', 'airflow',
'weight', 'weight_unit', 'front_image', 'rear_image', 'comments', 'tags', 'weight', 'weight_unit', 'front_image', 'rear_image', 'description', 'comments', 'tags',
] ]
widgets = { widgets = {
'airflow': StaticSelect(), 'airflow': StaticSelect(),
@ -419,14 +420,14 @@ class ModuleTypeForm(NetBoxModelForm):
fieldsets = ( fieldsets = (
('Module Type', ( ('Module Type', (
'manufacturer', 'model', 'part_number', 'tags', 'weight', 'weight_unit' 'manufacturer', 'model', 'part_number', 'tags', 'weight', 'weight_unit', 'description',
)), )),
) )
class Meta: class Meta:
model = ModuleType model = ModuleType
fields = [ fields = [
'manufacturer', 'model', 'part_number', 'weight', 'weight_unit', 'comments', 'tags', 'manufacturer', 'model', 'part_number', 'weight', 'weight_unit', 'description', 'comments', 'tags',
] ]
widgets = { widgets = {
@ -591,7 +592,7 @@ class DeviceForm(TenancyForm, NetBoxModelForm):
'name', 'device_role', 'device_type', 'serial', 'asset_tag', 'region', 'site_group', 'site', 'rack', 'name', 'device_role', 'device_type', 'serial', 'asset_tag', 'region', 'site_group', 'site', 'rack',
'location', 'position', 'face', 'status', 'airflow', 'platform', 'primary_ip4', 'primary_ip6', 'location', 'position', 'face', 'status', 'airflow', 'platform', 'primary_ip4', 'primary_ip6',
'cluster_group', 'cluster', 'tenant_group', 'tenant', 'virtual_chassis', 'vc_position', 'vc_priority', 'cluster_group', 'cluster', 'tenant_group', 'tenant', 'virtual_chassis', 'vc_position', 'vc_priority',
'comments', 'tags', 'local_context_data' 'description', 'comments', 'tags', 'local_context_data'
] ]
help_texts = { help_texts = {
'device_role': "The function this device serves", 'device_role': "The function this device serves",
@ -716,7 +717,7 @@ class ModuleForm(NetBoxModelForm):
model = Module model = Module
fields = [ fields = [
'device', 'module_bay', 'manufacturer', 'module_type', 'serial', 'asset_tag', 'tags', 'device', 'module_bay', 'manufacturer', 'module_type', 'serial', 'asset_tag', 'tags',
'replicate_components', 'adopt_components', 'comments', 'replicate_components', 'adopt_components', 'description', 'comments',
] ]
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -793,11 +794,13 @@ class ModuleForm(NetBoxModelForm):
class CableForm(TenancyForm, NetBoxModelForm): class CableForm(TenancyForm, NetBoxModelForm):
comments = CommentField()
class Meta: class Meta:
model = Cable model = Cable
fields = [ fields = [
'type', 'status', 'tenant_group', 'tenant', 'label', 'color', 'length', 'length_unit', 'tags', 'type', 'status', 'tenant_group', 'tenant', 'label', 'color', 'length', 'length_unit', 'description',
'comments', 'tags',
] ]
widgets = { widgets = {
'status': StaticSelect, 'status': StaticSelect,
@ -840,15 +843,16 @@ class PowerPanelForm(NetBoxModelForm):
'site_id': '$site' 'site_id': '$site'
} }
) )
comments = CommentField()
fieldsets = ( fieldsets = (
('Power Panel', ('region', 'site_group', 'site', 'location', 'name', 'tags')), ('Power Panel', ('region', 'site_group', 'site', 'location', 'name', 'description', 'tags')),
) )
class Meta: class Meta:
model = PowerPanel model = PowerPanel
fields = [ fields = [
'region', 'site_group', 'site', 'location', 'name', 'tags', 'region', 'site_group', 'site', 'location', 'name', 'description', 'comments', 'tags',
] ]
@ -894,7 +898,7 @@ class PowerFeedForm(NetBoxModelForm):
comments = CommentField() comments = CommentField()
fieldsets = ( fieldsets = (
('Power Panel', ('region', 'site', 'power_panel')), ('Power Panel', ('region', 'site', 'power_panel', 'description')),
('Power Feed', ('rack', 'name', 'status', 'type', 'mark_connected', 'tags')), ('Power Feed', ('rack', 'name', 'status', 'type', 'mark_connected', 'tags')),
('Characteristics', ('supply', 'voltage', 'amperage', 'phase', 'max_utilization')), ('Characteristics', ('supply', 'voltage', 'amperage', 'phase', 'max_utilization')),
) )
@ -903,7 +907,7 @@ class PowerFeedForm(NetBoxModelForm):
model = PowerFeed model = PowerFeed
fields = [ fields = [
'region', 'site_group', 'site', 'power_panel', 'rack', 'name', 'status', 'type', 'mark_connected', 'supply', 'region', 'site_group', 'site', 'power_panel', 'rack', 'name', 'status', 'type', 'mark_connected', 'supply',
'phase', 'voltage', 'amperage', 'max_utilization', 'comments', 'tags', 'phase', 'voltage', 'amperage', 'max_utilization', 'description', 'comments', 'tags',
] ]
widgets = { widgets = {
'status': StaticSelect(), 'status': StaticSelect(),
@ -922,11 +926,12 @@ class VirtualChassisForm(NetBoxModelForm):
queryset=Device.objects.all(), queryset=Device.objects.all(),
required=False, required=False,
) )
comments = CommentField()
class Meta: class Meta:
model = VirtualChassis model = VirtualChassis
fields = [ fields = [
'name', 'domain', 'master', 'tags', 'name', 'domain', 'master', 'description', 'comments', 'tags',
] ]
widgets = { widgets = {
'master': SelectWithPK(), 'master': SelectWithPK(),

View File

@ -30,7 +30,7 @@ class DeviceTypeImportForm(BootstrapMixin, forms.ModelForm):
model = DeviceType model = DeviceType
fields = [ fields = [
'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'subdevice_role', 'airflow', 'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'subdevice_role', 'airflow',
'comments', 'description', 'comments',
] ]
@ -42,7 +42,7 @@ class ModuleTypeImportForm(BootstrapMixin, forms.ModelForm):
class Meta: class Meta:
model = ModuleType model = ModuleType
fields = ['manufacturer', 'model', 'part_number', 'comments'] fields = ['manufacturer', 'model', 'part_number', 'description', 'comments']
# #

View File

@ -8,8 +8,8 @@ from ipam.models import ASN
from netbox.forms import NetBoxModelBulkEditForm from netbox.forms import NetBoxModelBulkEditForm
from tenancy.models import Tenant from tenancy.models import Tenant
from utilities.forms import ( from utilities.forms import (
add_blank_choice, BulkEditNullBooleanSelect, DynamicModelChoiceField, NumericArrayField, StaticSelect, add_blank_choice, BulkEditNullBooleanSelect, CommentField, DynamicModelChoiceField, NumericArrayField,
DynamicModelMultipleChoiceField, SmallTextarea, StaticSelect, DynamicModelMultipleChoiceField,
) )
__all__ = ( __all__ = (
@ -43,15 +43,19 @@ class VRFBulkEditForm(NetBoxModelBulkEditForm):
label='Enforce unique space' label='Enforce unique space'
) )
description = forms.CharField( description = forms.CharField(
max_length=100, max_length=200,
required=False required=False
) )
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = VRF model = VRF
fieldsets = ( fieldsets = (
(None, ('tenant', 'enforce_unique', 'description')), (None, ('tenant', 'enforce_unique', 'description')),
) )
nullable_fields = ('tenant', 'description') nullable_fields = ('tenant', 'description', 'comments')
class RouteTargetBulkEditForm(NetBoxModelBulkEditForm): class RouteTargetBulkEditForm(NetBoxModelBulkEditForm):
@ -63,12 +67,16 @@ class RouteTargetBulkEditForm(NetBoxModelBulkEditForm):
max_length=200, max_length=200,
required=False required=False
) )
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = RouteTarget model = RouteTarget
fieldsets = ( fieldsets = (
(None, ('tenant', 'description')), (None, ('tenant', 'description')),
) )
nullable_fields = ('tenant', 'description') nullable_fields = ('tenant', 'description', 'comments')
class RIRBulkEditForm(NetBoxModelBulkEditForm): class RIRBulkEditForm(NetBoxModelBulkEditForm):
@ -103,15 +111,19 @@ class ASNBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
description = forms.CharField( description = forms.CharField(
max_length=100, max_length=200,
required=False required=False
) )
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = ASN model = ASN
fieldsets = ( fieldsets = (
(None, ('sites', 'rir', 'tenant', 'description')), (None, ('sites', 'rir', 'tenant', 'description')),
) )
nullable_fields = ('date_added', 'description') nullable_fields = ('date_added', 'description', 'comments')
class AggregateBulkEditForm(NetBoxModelBulkEditForm): class AggregateBulkEditForm(NetBoxModelBulkEditForm):
@ -128,15 +140,19 @@ class AggregateBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
description = forms.CharField( description = forms.CharField(
max_length=100, max_length=200,
required=False required=False
) )
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = Aggregate model = Aggregate
fieldsets = ( fieldsets = (
(None, ('rir', 'tenant', 'date_added', 'description')), (None, ('rir', 'tenant', 'date_added', 'description')),
) )
nullable_fields = ('date_added', 'description') nullable_fields = ('date_added', 'description', 'comments')
class RoleBulkEditForm(NetBoxModelBulkEditForm): class RoleBulkEditForm(NetBoxModelBulkEditForm):
@ -206,9 +222,13 @@ class PrefixBulkEditForm(NetBoxModelBulkEditForm):
label='Treat as 100% utilized' label='Treat as 100% utilized'
) )
description = forms.CharField( description = forms.CharField(
max_length=100, max_length=200,
required=False required=False
) )
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = Prefix model = Prefix
fieldsets = ( fieldsets = (
@ -217,7 +237,7 @@ class PrefixBulkEditForm(NetBoxModelBulkEditForm):
('Addressing', ('vrf', 'prefix_length', 'is_pool', 'mark_utilized')), ('Addressing', ('vrf', 'prefix_length', 'is_pool', 'mark_utilized')),
) )
nullable_fields = ( nullable_fields = (
'site', 'vrf', 'tenant', 'role', 'description', 'site', 'vrf', 'tenant', 'role', 'description', 'comments',
) )
@ -241,16 +261,20 @@ class IPRangeBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
description = forms.CharField( description = forms.CharField(
max_length=100, max_length=200,
required=False required=False
) )
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = IPRange model = IPRange
fieldsets = ( fieldsets = (
(None, ('status', 'role', 'vrf', 'tenant', 'description')), (None, ('status', 'role', 'vrf', 'tenant', 'description')),
) )
nullable_fields = ( nullable_fields = (
'vrf', 'tenant', 'role', 'description', 'vrf', 'tenant', 'role', 'description', 'comments',
) )
@ -285,9 +309,13 @@ class IPAddressBulkEditForm(NetBoxModelBulkEditForm):
label='DNS name' label='DNS name'
) )
description = forms.CharField( description = forms.CharField(
max_length=100, max_length=200,
required=False required=False
) )
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = IPAddress model = IPAddress
fieldsets = ( fieldsets = (
@ -295,7 +323,7 @@ class IPAddressBulkEditForm(NetBoxModelBulkEditForm):
('Addressing', ('vrf', 'mask_length', 'dns_name')), ('Addressing', ('vrf', 'mask_length', 'dns_name')),
) )
nullable_fields = ( nullable_fields = (
'vrf', 'role', 'tenant', 'dns_name', 'description', 'vrf', 'role', 'tenant', 'dns_name', 'description', 'comments',
) )
@ -329,13 +357,17 @@ class FHRPGroupBulkEditForm(NetBoxModelBulkEditForm):
max_length=200, max_length=200,
required=False required=False
) )
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = FHRPGroup model = FHRPGroup
fieldsets = ( fieldsets = (
(None, ('protocol', 'group_id', 'name', 'description')), (None, ('protocol', 'group_id', 'name', 'description')),
('Authentication', ('auth_type', 'auth_key')), ('Authentication', ('auth_type', 'auth_key')),
) )
nullable_fields = ('auth_type', 'auth_key', 'name', 'description') nullable_fields = ('auth_type', 'auth_key', 'name', 'description', 'comments')
class VLANGroupBulkEditForm(NetBoxModelBulkEditForm): class VLANGroupBulkEditForm(NetBoxModelBulkEditForm):
@ -405,9 +437,13 @@ class VLANBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
description = forms.CharField( description = forms.CharField(
max_length=100, max_length=200,
required=False required=False
) )
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = VLAN model = VLAN
fieldsets = ( fieldsets = (
@ -415,7 +451,7 @@ class VLANBulkEditForm(NetBoxModelBulkEditForm):
('Site & Group', ('region', 'site_group', 'site', 'group')), ('Site & Group', ('region', 'site_group', 'site', 'group')),
) )
nullable_fields = ( nullable_fields = (
'site', 'group', 'tenant', 'role', 'description', 'site', 'group', 'tenant', 'role', 'description', 'comments',
) )
@ -433,15 +469,19 @@ class ServiceTemplateBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
description = forms.CharField( description = forms.CharField(
max_length=100, max_length=200,
required=False required=False
) )
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = ServiceTemplate model = ServiceTemplate
fieldsets = ( fieldsets = (
(None, ('protocol', 'ports', 'description')), (None, ('protocol', 'ports', 'description')),
) )
nullable_fields = ('description',) nullable_fields = ('description', 'comments')
class ServiceBulkEditForm(ServiceTemplateBulkEditForm): class ServiceBulkEditForm(ServiceTemplateBulkEditForm):
@ -459,15 +499,19 @@ class L2VPNBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
description = forms.CharField( description = forms.CharField(
max_length=100, max_length=200,
required=False required=False
) )
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = L2VPN model = L2VPN
fieldsets = ( fieldsets = (
(None, ('type', 'description', 'tenant')), (None, ('type', 'tenant', 'description')),
) )
nullable_fields = ('tenant', 'description',) nullable_fields = ('tenant', 'description', 'comments')
class L2VPNTerminationBulkEditForm(NetBoxModelBulkEditForm): class L2VPNTerminationBulkEditForm(NetBoxModelBulkEditForm):

View File

@ -41,7 +41,7 @@ class VRFCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = VRF model = VRF
fields = ('name', 'rd', 'tenant', 'enforce_unique', 'description') fields = ('name', 'rd', 'tenant', 'enforce_unique', 'description', 'comments')
class RouteTargetCSVForm(NetBoxModelCSVForm): class RouteTargetCSVForm(NetBoxModelCSVForm):
@ -54,7 +54,7 @@ class RouteTargetCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = RouteTarget model = RouteTarget
fields = ('name', 'description', 'tenant') fields = ('name', 'tenant', 'description', 'comments')
class RIRCSVForm(NetBoxModelCSVForm): class RIRCSVForm(NetBoxModelCSVForm):
@ -83,7 +83,7 @@ class AggregateCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = Aggregate model = Aggregate
fields = ('prefix', 'rir', 'tenant', 'date_added', 'description') fields = ('prefix', 'rir', 'tenant', 'date_added', 'description', 'comments')
class ASNCSVForm(NetBoxModelCSVForm): class ASNCSVForm(NetBoxModelCSVForm):
@ -101,7 +101,7 @@ class ASNCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = ASN model = ASN
fields = ('asn', 'rir', 'tenant', 'description') fields = ('asn', 'rir', 'tenant', 'description', 'comments')
help_texts = {} help_texts = {}
@ -159,7 +159,7 @@ class PrefixCSVForm(NetBoxModelCSVForm):
model = Prefix model = Prefix
fields = ( fields = (
'prefix', 'vrf', 'tenant', 'site', 'vlan_group', 'vlan', 'status', 'role', 'is_pool', 'mark_utilized', 'prefix', 'vrf', 'tenant', 'site', 'vlan_group', 'vlan', 'status', 'role', 'is_pool', 'mark_utilized',
'description', 'description', 'comments',
) )
def __init__(self, data=None, *args, **kwargs): def __init__(self, data=None, *args, **kwargs):
@ -204,7 +204,7 @@ class IPRangeCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = IPRange model = IPRange
fields = ( fields = (
'start_address', 'end_address', 'vrf', 'tenant', 'status', 'role', 'description', 'start_address', 'end_address', 'vrf', 'tenant', 'status', 'role', 'description', 'comments',
) )
@ -257,7 +257,7 @@ class IPAddressCSVForm(NetBoxModelCSVForm):
model = IPAddress model = IPAddress
fields = [ fields = [
'address', 'vrf', 'tenant', 'status', 'role', 'device', 'virtual_machine', 'interface', 'is_primary', 'address', 'vrf', 'tenant', 'status', 'role', 'device', 'virtual_machine', 'interface', 'is_primary',
'dns_name', 'description', 'dns_name', 'description', 'comments',
] ]
def __init__(self, data=None, *args, **kwargs): def __init__(self, data=None, *args, **kwargs):
@ -326,7 +326,7 @@ class FHRPGroupCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = FHRPGroup model = FHRPGroup
fields = ('protocol', 'group_id', 'auth_type', 'auth_key', 'name', 'description') fields = ('protocol', 'group_id', 'auth_type', 'auth_key', 'name', 'description', 'comments')
class VLANGroupCSVForm(NetBoxModelCSVForm): class VLANGroupCSVForm(NetBoxModelCSVForm):
@ -389,7 +389,7 @@ class VLANCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = VLAN model = VLAN
fields = ('site', 'group', 'vid', 'name', 'tenant', 'status', 'role', 'description') fields = ('site', 'group', 'vid', 'name', 'tenant', 'status', 'role', 'description', 'comments')
help_texts = { help_texts = {
'vid': 'Numeric VLAN ID (1-4094)', 'vid': 'Numeric VLAN ID (1-4094)',
'name': 'VLAN name', 'name': 'VLAN name',
@ -404,7 +404,7 @@ class ServiceTemplateCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = ServiceTemplate model = ServiceTemplate
fields = ('name', 'protocol', 'ports', 'description') fields = ('name', 'protocol', 'ports', 'description', 'comments')
class ServiceCSVForm(NetBoxModelCSVForm): class ServiceCSVForm(NetBoxModelCSVForm):
@ -427,7 +427,7 @@ class ServiceCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = Service model = Service
fields = ('device', 'virtual_machine', 'name', 'protocol', 'ports', 'description') fields = ('device', 'virtual_machine', 'name', 'protocol', 'ports', 'description', 'comments')
class L2VPNCSVForm(NetBoxModelCSVForm): class L2VPNCSVForm(NetBoxModelCSVForm):
@ -443,7 +443,7 @@ class L2VPNCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = L2VPN model = L2VPN
fields = ('identifier', 'name', 'slug', 'type', 'description') fields = ('identifier', 'name', 'slug', 'type', 'description', 'comments')
class L2VPNTerminationCSVForm(NetBoxModelCSVForm): class L2VPNTerminationCSVForm(NetBoxModelCSVForm):

View File

@ -11,7 +11,7 @@ from netbox.forms import NetBoxModelForm
from tenancy.forms import TenancyForm from tenancy.forms import TenancyForm
from utilities.exceptions import PermissionsViolation from utilities.exceptions import PermissionsViolation
from utilities.forms import ( from utilities.forms import (
add_blank_choice, BootstrapMixin, ContentTypeChoiceField, DatePicker, DynamicModelChoiceField, add_blank_choice, BootstrapMixin, CommentField, ContentTypeChoiceField, DatePicker, DynamicModelChoiceField,
DynamicModelMultipleChoiceField, NumericArrayField, SlugField, StaticSelect, StaticSelectMultiple, DynamicModelMultipleChoiceField, NumericArrayField, SlugField, StaticSelect, StaticSelectMultiple,
) )
from virtualization.models import Cluster, ClusterGroup, VirtualMachine, VMInterface from virtualization.models import Cluster, ClusterGroup, VirtualMachine, VMInterface
@ -49,6 +49,7 @@ class VRFForm(TenancyForm, NetBoxModelForm):
queryset=RouteTarget.objects.all(), queryset=RouteTarget.objects.all(),
required=False required=False
) )
comments = CommentField()
fieldsets = ( fieldsets = (
('VRF', ('name', 'rd', 'enforce_unique', 'description', 'tags')), ('VRF', ('name', 'rd', 'enforce_unique', 'description', 'tags')),
@ -59,8 +60,8 @@ class VRFForm(TenancyForm, NetBoxModelForm):
class Meta: class Meta:
model = VRF model = VRF
fields = [ fields = [
'name', 'rd', 'enforce_unique', 'description', 'import_targets', 'export_targets', 'tenant_group', 'tenant', 'name', 'rd', 'enforce_unique', 'import_targets', 'export_targets', 'tenant_group', 'tenant', 'description',
'tags', 'comments', 'tags',
] ]
labels = { labels = {
'rd': "RD", 'rd': "RD",
@ -75,11 +76,12 @@ class RouteTargetForm(TenancyForm, NetBoxModelForm):
('Route Target', ('name', 'description', 'tags')), ('Route Target', ('name', 'description', 'tags')),
('Tenancy', ('tenant_group', 'tenant')), ('Tenancy', ('tenant_group', 'tenant')),
) )
comments = CommentField()
class Meta: class Meta:
model = RouteTarget model = RouteTarget
fields = [ fields = [
'name', 'description', 'tenant_group', 'tenant', 'tags', 'name', 'tenant_group', 'tenant', 'description', 'comments', 'tags',
] ]
@ -104,6 +106,7 @@ class AggregateForm(TenancyForm, NetBoxModelForm):
queryset=RIR.objects.all(), queryset=RIR.objects.all(),
label='RIR' label='RIR'
) )
comments = CommentField()
fieldsets = ( fieldsets = (
('Aggregate', ('prefix', 'rir', 'date_added', 'description', 'tags')), ('Aggregate', ('prefix', 'rir', 'date_added', 'description', 'tags')),
@ -113,7 +116,7 @@ class AggregateForm(TenancyForm, NetBoxModelForm):
class Meta: class Meta:
model = Aggregate model = Aggregate
fields = [ fields = [
'prefix', 'rir', 'date_added', 'description', 'tenant_group', 'tenant', 'tags', 'prefix', 'rir', 'date_added', 'tenant_group', 'tenant', 'description', 'comments', 'tags',
] ]
help_texts = { help_texts = {
'prefix': "IPv4 or IPv6 network", 'prefix': "IPv4 or IPv6 network",
@ -134,6 +137,7 @@ class ASNForm(TenancyForm, NetBoxModelForm):
label='Sites', label='Sites',
required=False required=False
) )
comments = CommentField()
fieldsets = ( fieldsets = (
('ASN', ('asn', 'rir', 'sites', 'description', 'tags')), ('ASN', ('asn', 'rir', 'sites', 'description', 'tags')),
@ -143,7 +147,7 @@ class ASNForm(TenancyForm, NetBoxModelForm):
class Meta: class Meta:
model = ASN model = ASN
fields = [ fields = [
'asn', 'rir', 'sites', 'tenant_group', 'tenant', 'description', 'tags' 'asn', 'rir', 'sites', 'tenant_group', 'tenant', 'description', 'comments', 'tags'
] ]
help_texts = { help_texts = {
'asn': "AS number", 'asn': "AS number",
@ -235,6 +239,7 @@ class PrefixForm(TenancyForm, NetBoxModelForm):
queryset=Role.objects.all(), queryset=Role.objects.all(),
required=False required=False
) )
comments = CommentField()
fieldsets = ( fieldsets = (
('Prefix', ('prefix', 'status', 'vrf', 'role', 'is_pool', 'mark_utilized', 'description', 'tags')), ('Prefix', ('prefix', 'status', 'vrf', 'role', 'is_pool', 'mark_utilized', 'description', 'tags')),
@ -245,8 +250,8 @@ class PrefixForm(TenancyForm, NetBoxModelForm):
class Meta: class Meta:
model = Prefix model = Prefix
fields = [ fields = [
'prefix', 'vrf', 'site', 'vlan', 'status', 'role', 'is_pool', 'mark_utilized', 'description', 'prefix', 'vrf', 'site', 'vlan', 'status', 'role', 'is_pool', 'mark_utilized', 'tenant_group', 'tenant',
'tenant_group', 'tenant', 'tags', 'description', 'comments', 'tags',
] ]
widgets = { widgets = {
'status': StaticSelect(), 'status': StaticSelect(),
@ -263,6 +268,7 @@ class IPRangeForm(TenancyForm, NetBoxModelForm):
queryset=Role.objects.all(), queryset=Role.objects.all(),
required=False required=False
) )
comments = CommentField()
fieldsets = ( fieldsets = (
('IP Range', ('vrf', 'start_address', 'end_address', 'role', 'status', 'description', 'tags')), ('IP Range', ('vrf', 'start_address', 'end_address', 'role', 'status', 'description', 'tags')),
@ -272,7 +278,8 @@ class IPRangeForm(TenancyForm, NetBoxModelForm):
class Meta: class Meta:
model = IPRange model = IPRange
fields = [ fields = [
'vrf', 'start_address', 'end_address', 'status', 'role', 'description', 'tenant_group', 'tenant', 'tags', 'vrf', 'start_address', 'end_address', 'status', 'role', 'tenant_group', 'tenant', 'description',
'comments', 'tags',
] ]
widgets = { widgets = {
'status': StaticSelect(), 'status': StaticSelect(),
@ -394,13 +401,14 @@ class IPAddressForm(TenancyForm, NetBoxModelForm):
required=False, required=False,
label='Make this the primary IP for the device/VM' label='Make this the primary IP for the device/VM'
) )
comments = CommentField()
class Meta: class Meta:
model = IPAddress model = IPAddress
fields = [ fields = [
'address', 'vrf', 'status', 'role', 'dns_name', 'description', 'primary_for_parent', 'nat_site', 'nat_rack', 'address', 'vrf', 'status', 'role', 'dns_name', 'primary_for_parent', 'nat_site', 'nat_rack', 'nat_device',
'nat_device', 'nat_cluster', 'nat_virtual_machine', 'nat_vrf', 'nat_inside', 'tenant_group', 'tenant', 'nat_cluster', 'nat_virtual_machine', 'nat_vrf', 'nat_inside', 'tenant_group', 'tenant', 'description',
'tags', 'comments', 'tags',
] ]
widgets = { widgets = {
'status': StaticSelect(), 'status': StaticSelect(),
@ -535,6 +543,7 @@ class FHRPGroupForm(NetBoxModelForm):
required=False, required=False,
label='Status' label='Status'
) )
comments = CommentField()
fieldsets = ( fieldsets = (
('FHRP Group', ('protocol', 'group_id', 'name', 'description', 'tags')), ('FHRP Group', ('protocol', 'group_id', 'name', 'description', 'tags')),
@ -545,7 +554,8 @@ class FHRPGroupForm(NetBoxModelForm):
class Meta: class Meta:
model = FHRPGroup model = FHRPGroup
fields = ( fields = (
'protocol', 'group_id', 'auth_type', 'auth_key', 'name', 'description', 'ip_vrf', 'ip_address', 'ip_status', 'tags', 'protocol', 'group_id', 'auth_type', 'auth_key', 'name', 'ip_vrf', 'ip_address', 'ip_status', 'description',
'comments', 'tags',
) )
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
@ -767,11 +777,13 @@ class VLANForm(TenancyForm, NetBoxModelForm):
queryset=Role.objects.all(), queryset=Role.objects.all(),
required=False required=False
) )
comments = CommentField()
class Meta: class Meta:
model = VLAN model = VLAN
fields = [ fields = [
'site', 'group', 'vid', 'name', 'status', 'role', 'description', 'tenant_group', 'tenant', 'tags', 'site', 'group', 'vid', 'name', 'status', 'role', 'tenant_group', 'tenant', 'description', 'comments',
'tags',
] ]
help_texts = { help_texts = {
'site': "Leave blank if this VLAN spans multiple sites", 'site': "Leave blank if this VLAN spans multiple sites",
@ -794,6 +806,7 @@ class ServiceTemplateForm(NetBoxModelForm):
), ),
help_text="Comma-separated list of one or more port numbers. A range may be specified using a hyphen." help_text="Comma-separated list of one or more port numbers. A range may be specified using a hyphen."
) )
comments = CommentField()
fieldsets = ( fieldsets = (
('Service Template', ( ('Service Template', (
@ -803,7 +816,7 @@ class ServiceTemplateForm(NetBoxModelForm):
class Meta: class Meta:
model = ServiceTemplate model = ServiceTemplate
fields = ('name', 'protocol', 'ports', 'description', 'tags') fields = ('name', 'protocol', 'ports', 'description', 'comments', 'tags')
widgets = { widgets = {
'protocol': StaticSelect(), 'protocol': StaticSelect(),
} }
@ -834,11 +847,12 @@ class ServiceForm(NetBoxModelForm):
'virtual_machine_id': '$virtual_machine', 'virtual_machine_id': '$virtual_machine',
} }
) )
comments = CommentField()
class Meta: class Meta:
model = Service model = Service
fields = [ fields = [
'device', 'virtual_machine', 'name', 'protocol', 'ports', 'ipaddresses', 'description', 'tags', 'device', 'virtual_machine', 'name', 'protocol', 'ports', 'ipaddresses', 'description', 'comments', 'tags',
] ]
help_texts = { help_texts = {
'ipaddresses': "IP address assignment is optional. If no IPs are selected, the service is assumed to be " 'ipaddresses': "IP address assignment is optional. If no IPs are selected, the service is assumed to be "
@ -899,6 +913,7 @@ class L2VPNForm(TenancyForm, NetBoxModelForm):
queryset=RouteTarget.objects.all(), queryset=RouteTarget.objects.all(),
required=False required=False
) )
comments = CommentField()
fieldsets = ( fieldsets = (
('L2VPN', ('name', 'slug', 'type', 'identifier', 'description', 'tags')), ('L2VPN', ('name', 'slug', 'type', 'identifier', 'description', 'tags')),
@ -909,7 +924,8 @@ class L2VPNForm(TenancyForm, NetBoxModelForm):
class Meta: class Meta:
model = L2VPN model = L2VPN
fields = ( fields = (
'name', 'slug', 'type', 'identifier', 'description', 'import_targets', 'export_targets', 'tenant', 'tags' 'name', 'slug', 'type', 'identifier', 'import_targets', 'export_targets', 'tenant', 'description',
'comments', 'tags'
) )
widgets = { widgets = {
'type': StaticSelect(), 'type': StaticSelect(),

View File

@ -2,7 +2,7 @@ from django import forms
from netbox.forms import NetBoxModelBulkEditForm from netbox.forms import NetBoxModelBulkEditForm
from tenancy.models import * from tenancy.models import *
from utilities.forms import DynamicModelChoiceField from utilities.forms import CommentField, DynamicModelChoiceField, SmallTextarea
__all__ = ( __all__ = (
'ContactBulkEditForm', 'ContactBulkEditForm',
@ -101,9 +101,17 @@ class ContactBulkEditForm(NetBoxModelBulkEditForm):
link = forms.URLField( link = forms.URLField(
required=False required=False
) )
description = forms.CharField(
max_length=200,
required=False
)
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = Contact model = Contact
fieldsets = ( fieldsets = (
(None, ('group', 'title', 'phone', 'email', 'address', 'link')), (None, ('group', 'title', 'phone', 'email', 'address', 'link', 'description')),
) )
nullable_fields = ('group', 'title', 'phone', 'email', 'address', 'link', 'comments') nullable_fields = ('group', 'title', 'phone', 'email', 'address', 'link', 'description', 'comments')

View File

@ -79,4 +79,4 @@ class ContactCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = Contact model = Contact
fields = ('name', 'title', 'phone', 'email', 'address', 'link', 'group', 'comments') fields = ('name', 'title', 'phone', 'email', 'address', 'link', 'group', 'description', 'comments')

View File

@ -103,13 +103,13 @@ class ContactForm(NetBoxModelForm):
comments = CommentField() comments = CommentField()
fieldsets = ( fieldsets = (
('Contact', ('group', 'name', 'title', 'phone', 'email', 'address', 'link', 'tags')), ('Contact', ('group', 'name', 'title', 'phone', 'email', 'address', 'link', 'description', 'tags')),
) )
class Meta: class Meta:
model = Contact model = Contact
fields = ( fields = (
'group', 'name', 'title', 'phone', 'email', 'address', 'link', 'comments', 'tags', 'group', 'name', 'title', 'phone', 'email', 'address', 'link', 'description', 'comments', 'tags',
) )
widgets = { widgets = {
'address': SmallTextarea(attrs={'rows': 3}), 'address': SmallTextarea(attrs={'rows': 3}),

View File

@ -84,6 +84,10 @@ class ClusterBulkEditForm(NetBoxModelBulkEditForm):
'group_id': '$site_group', 'group_id': '$site_group',
} }
) )
description = forms.CharField(
max_length=200,
required=False
)
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=SmallTextarea,
label='Comments' label='Comments'
@ -91,11 +95,11 @@ class ClusterBulkEditForm(NetBoxModelBulkEditForm):
model = Cluster model = Cluster
fieldsets = ( fieldsets = (
(None, ('type', 'group', 'status', 'tenant',)), (None, ('type', 'group', 'status', 'tenant', 'description')),
('Site', ('region', 'site_group', 'site',)), ('Site', ('region', 'site_group', 'site')),
) )
nullable_fields = ( nullable_fields = (
'group', 'site', 'comments', 'tenant', 'group', 'site', 'tenant', 'description', 'comments',
) )
@ -153,6 +157,10 @@ class VirtualMachineBulkEditForm(NetBoxModelBulkEditForm):
required=False, required=False,
label='Disk (GB)' label='Disk (GB)'
) )
description = forms.CharField(
max_length=200,
required=False
)
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=SmallTextarea,
label='Comments' label='Comments'
@ -160,11 +168,11 @@ class VirtualMachineBulkEditForm(NetBoxModelBulkEditForm):
model = VirtualMachine model = VirtualMachine
fieldsets = ( fieldsets = (
(None, ('site', 'cluster', 'device', 'status', 'role', 'tenant', 'platform')), (None, ('site', 'cluster', 'device', 'status', 'role', 'tenant', 'platform', 'description')),
('Resources', ('vcpus', 'memory', 'disk')) ('Resources', ('vcpus', 'memory', 'disk'))
) )
nullable_fields = ( nullable_fields = (
'site', 'cluster', 'device', 'role', 'tenant', 'platform', 'vcpus', 'memory', 'disk', 'comments', 'site', 'cluster', 'device', 'role', 'tenant', 'platform', 'vcpus', 'memory', 'disk', 'description', 'comments',
) )

View File

@ -63,7 +63,7 @@ class ClusterCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = Cluster model = Cluster
fields = ('name', 'type', 'group', 'status', 'site', 'comments') fields = ('name', 'type', 'group', 'status', 'site', 'description', 'comments')
class VirtualMachineCSVForm(NetBoxModelCSVForm): class VirtualMachineCSVForm(NetBoxModelCSVForm):
@ -114,7 +114,7 @@ class VirtualMachineCSVForm(NetBoxModelCSVForm):
model = VirtualMachine model = VirtualMachine
fields = ( fields = (
'name', 'status', 'role', 'site', 'cluster', 'device', 'tenant', 'platform', 'vcpus', 'memory', 'disk', 'name', 'status', 'role', 'site', 'cluster', 'device', 'tenant', 'platform', 'vcpus', 'memory', 'disk',
'comments', 'description', 'comments',
) )

View File

@ -90,7 +90,7 @@ class ClusterForm(TenancyForm, NetBoxModelForm):
comments = CommentField() comments = CommentField()
fieldsets = ( fieldsets = (
('Cluster', ('name', 'type', 'group', 'status', 'tags')), ('Cluster', ('name', 'type', 'group', 'status', 'description', 'tags')),
('Site', ('region', 'site_group', 'site')), ('Site', ('region', 'site_group', 'site')),
('Tenancy', ('tenant_group', 'tenant')), ('Tenancy', ('tenant_group', 'tenant')),
) )
@ -98,7 +98,8 @@ class ClusterForm(TenancyForm, NetBoxModelForm):
class Meta: class Meta:
model = Cluster model = Cluster
fields = ( fields = (
'name', 'type', 'group', 'status', 'tenant', 'region', 'site_group', 'site', 'comments', 'tags', 'name', 'type', 'group', 'status', 'tenant', 'region', 'site_group', 'site', 'description', 'comments',
'tags',
) )
widgets = { widgets = {
'status': StaticSelect(), 'status': StaticSelect(),
@ -220,9 +221,10 @@ class VirtualMachineForm(TenancyForm, NetBoxModelForm):
required=False, required=False,
label='' label=''
) )
comments = CommentField()
fieldsets = ( fieldsets = (
('Virtual Machine', ('name', 'role', 'status', 'tags')), ('Virtual Machine', ('name', 'role', 'status', 'description', 'tags')),
('Site/Cluster', ('site', 'cluster_group', 'cluster', 'device')), ('Site/Cluster', ('site', 'cluster_group', 'cluster', 'device')),
('Tenancy', ('tenant_group', 'tenant')), ('Tenancy', ('tenant_group', 'tenant')),
('Management', ('platform', 'primary_ip4', 'primary_ip6')), ('Management', ('platform', 'primary_ip4', 'primary_ip6')),
@ -234,7 +236,7 @@ class VirtualMachineForm(TenancyForm, NetBoxModelForm):
model = VirtualMachine model = VirtualMachine
fields = [ fields = [
'name', 'status', 'site', 'cluster_group', 'cluster', 'device', 'role', 'tenant_group', 'tenant', 'name', 'status', 'site', 'cluster_group', 'cluster', 'device', 'role', 'tenant_group', 'tenant',
'platform', 'primary_ip4', 'primary_ip6', 'vcpus', 'memory', 'disk', 'comments', 'tags', 'platform', 'primary_ip4', 'primary_ip6', 'vcpus', 'memory', 'disk', 'description', 'comments', 'tags',
'local_context_data', 'local_context_data',
] ]
help_texts = { help_texts = {

View File

@ -4,7 +4,7 @@ from dcim.choices import LinkStatusChoices
from ipam.models import VLAN from ipam.models import VLAN
from netbox.forms import NetBoxModelBulkEditForm from netbox.forms import NetBoxModelBulkEditForm
from tenancy.models import Tenant from tenancy.models import Tenant
from utilities.forms import add_blank_choice, DynamicModelChoiceField from utilities.forms import add_blank_choice, CommentField, DynamicModelChoiceField, SmallTextarea
from wireless.choices import * from wireless.choices import *
from wireless.constants import SSID_MAX_LENGTH from wireless.constants import SSID_MAX_LENGTH
from wireless.models import * from wireless.models import *
@ -52,9 +52,6 @@ class WirelessLANBulkEditForm(NetBoxModelBulkEditForm):
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
required=False required=False
) )
description = forms.CharField(
required=False
)
auth_type = forms.ChoiceField( auth_type = forms.ChoiceField(
choices=add_blank_choice(WirelessAuthTypeChoices), choices=add_blank_choice(WirelessAuthTypeChoices),
required=False required=False
@ -67,6 +64,14 @@ class WirelessLANBulkEditForm(NetBoxModelBulkEditForm):
required=False, required=False,
label='Pre-shared key' label='Pre-shared key'
) )
description = forms.CharField(
max_length=200,
required=False
)
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = WirelessLAN model = WirelessLAN
fieldsets = ( fieldsets = (
@ -74,7 +79,7 @@ class WirelessLANBulkEditForm(NetBoxModelBulkEditForm):
('Authentication', ('auth_type', 'auth_cipher', 'auth_psk')), ('Authentication', ('auth_type', 'auth_cipher', 'auth_psk')),
) )
nullable_fields = ( nullable_fields = (
'ssid', 'group', 'vlan', 'tenant', 'description', 'auth_type', 'auth_cipher', 'auth_psk', 'ssid', 'group', 'vlan', 'tenant', 'description', 'auth_type', 'auth_cipher', 'auth_psk', 'comments',
) )
@ -92,9 +97,6 @@ class WirelessLinkBulkEditForm(NetBoxModelBulkEditForm):
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
required=False required=False
) )
description = forms.CharField(
required=False
)
auth_type = forms.ChoiceField( auth_type = forms.ChoiceField(
choices=add_blank_choice(WirelessAuthTypeChoices), choices=add_blank_choice(WirelessAuthTypeChoices),
required=False required=False
@ -107,6 +109,14 @@ class WirelessLinkBulkEditForm(NetBoxModelBulkEditForm):
required=False, required=False,
label='Pre-shared key' label='Pre-shared key'
) )
description = forms.CharField(
max_length=200,
required=False
)
comments = CommentField(
widget=SmallTextarea,
label='Comments'
)
model = WirelessLink model = WirelessLink
fieldsets = ( fieldsets = (
@ -114,5 +124,5 @@ class WirelessLinkBulkEditForm(NetBoxModelBulkEditForm):
('Authentication', ('auth_type', 'auth_cipher', 'auth_psk')) ('Authentication', ('auth_type', 'auth_cipher', 'auth_psk'))
) )
nullable_fields = ( nullable_fields = (
'ssid', 'tenant', 'description', 'auth_type', 'auth_cipher', 'auth_psk', 'ssid', 'tenant', 'description', 'auth_type', 'auth_cipher', 'auth_psk', 'comments',
) )

View File

@ -60,7 +60,9 @@ class WirelessLANCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = WirelessLAN model = WirelessLAN
fields = ('ssid', 'group', 'vlan', 'tenant', 'description', 'auth_type', 'auth_cipher', 'auth_psk') fields = (
'ssid', 'group', 'vlan', 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'description', 'comments',
)
class WirelessLinkCSVForm(NetBoxModelCSVForm): class WirelessLinkCSVForm(NetBoxModelCSVForm):
@ -94,5 +96,6 @@ class WirelessLinkCSVForm(NetBoxModelCSVForm):
class Meta: class Meta:
model = WirelessLink model = WirelessLink
fields = ( fields = (
'interface_a', 'interface_b', 'ssid', 'tenant', 'description', 'auth_type', 'auth_cipher', 'auth_psk', 'interface_a', 'interface_b', 'ssid', 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'description',
'comments',
) )

View File

@ -2,7 +2,7 @@ from dcim.models import Device, Interface, Location, Region, Site, SiteGroup
from ipam.models import VLAN, VLANGroup from ipam.models import VLAN, VLANGroup
from netbox.forms import NetBoxModelForm from netbox.forms import NetBoxModelForm
from tenancy.forms import TenancyForm from tenancy.forms import TenancyForm
from utilities.forms import DynamicModelChoiceField, SlugField, StaticSelect from utilities.forms import CommentField, DynamicModelChoiceField, SlugField, StaticSelect
from wireless.models import * from wireless.models import *
__all__ = ( __all__ = (
@ -82,6 +82,7 @@ class WirelessLANForm(TenancyForm, NetBoxModelForm):
'group_id': '$vlan_group', 'group_id': '$vlan_group',
} }
) )
comments = CommentField()
fieldsets = ( fieldsets = (
('Wireless LAN', ('ssid', 'group', 'description', 'tags')), ('Wireless LAN', ('ssid', 'group', 'description', 'tags')),
@ -93,8 +94,8 @@ class WirelessLANForm(TenancyForm, NetBoxModelForm):
class Meta: class Meta:
model = WirelessLAN model = WirelessLAN
fields = [ fields = [
'ssid', 'group', 'description', 'region', 'site_group', 'site', 'vlan_group', 'vlan', 'tenant_group', 'ssid', 'group', 'region', 'site_group', 'site', 'vlan_group', 'vlan', 'tenant_group', 'tenant',
'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'tags', 'auth_type', 'auth_cipher', 'auth_psk', 'description', 'comments', 'tags',
] ]
widgets = { widgets = {
'auth_type': StaticSelect, 'auth_type': StaticSelect,
@ -183,6 +184,7 @@ class WirelessLinkForm(TenancyForm, NetBoxModelForm):
disabled_indicator='_occupied', disabled_indicator='_occupied',
label='Interface' label='Interface'
) )
comments = CommentField()
fieldsets = ( fieldsets = (
('Side A', ('site_a', 'location_a', 'device_a', 'interface_a')), ('Side A', ('site_a', 'location_a', 'device_a', 'interface_a')),
@ -196,7 +198,8 @@ class WirelessLinkForm(TenancyForm, NetBoxModelForm):
model = WirelessLink model = WirelessLink
fields = [ fields = [
'site_a', 'location_a', 'device_a', 'interface_a', 'site_b', 'location_b', 'device_b', 'interface_b', 'site_a', 'location_a', 'device_a', 'interface_a', 'site_b', 'location_b', 'device_b', 'interface_b',
'status', 'ssid', 'tenant_group', 'tenant', 'description', 'auth_type', 'auth_cipher', 'auth_psk', 'tags', 'status', 'ssid', 'tenant_group', 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'description',
'comments', 'tags',
] ]
widgets = { widgets = {
'status': StaticSelect, 'status': StaticSelect,