1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #2643: Add description field to console/power components and device bays

This commit is contained in:
Jeremy Stretch
2019-02-20 14:34:05 -05:00
parent 0a06d92c2e
commit bb6fb81fc0
12 changed files with 181 additions and 54 deletions

View File

@ -1854,7 +1854,7 @@ class ConsolePortForm(BootstrapMixin, forms.ModelForm):
class Meta:
model = ConsolePort
fields = [
'device', 'name', 'tags',
'device', 'name', 'description', 'tags',
]
widgets = {
'device': forms.HiddenInput(),
@ -1865,6 +1865,10 @@ class ConsolePortCreateForm(ComponentForm):
name_pattern = ExpandableNameField(
label='Name'
)
description = forms.CharField(
max_length=100,
required=False
)
tags = TagField(
required=False
)
@ -1882,7 +1886,7 @@ class ConsoleServerPortForm(BootstrapMixin, forms.ModelForm):
class Meta:
model = ConsoleServerPort
fields = [
'device', 'name', 'tags',
'device', 'name', 'description', 'tags',
]
widgets = {
'device': forms.HiddenInput(),
@ -1893,11 +1897,31 @@ class ConsoleServerPortCreateForm(ComponentForm):
name_pattern = ExpandableNameField(
label='Name'
)
description = forms.CharField(
max_length=100,
required=False
)
tags = TagField(
required=False
)
class ConsoleServerPortBulkEditForm(BootstrapMixin, AddRemoveTagsForm, BulkEditForm):
pk = forms.ModelMultipleChoiceField(
queryset=ConsoleServerPort.objects.all(),
widget=forms.MultipleHiddenInput()
)
description = forms.CharField(
max_length=100,
required=False
)
class Meta:
nullable_fields = [
'description',
]
class ConsoleServerPortBulkRenameForm(BulkRenameForm):
pk = forms.ModelMultipleChoiceField(
queryset=ConsoleServerPort.objects.all(),
@ -1924,7 +1948,7 @@ class PowerPortForm(BootstrapMixin, forms.ModelForm):
class Meta:
model = PowerPort
fields = [
'device', 'name', 'tags',
'device', 'name', 'description', 'tags',
]
widgets = {
'device': forms.HiddenInput(),
@ -1935,6 +1959,10 @@ class PowerPortCreateForm(ComponentForm):
name_pattern = ExpandableNameField(
label='Name'
)
description = forms.CharField(
max_length=100,
required=False
)
tags = TagField(
required=False
)
@ -1952,7 +1980,7 @@ class PowerOutletForm(BootstrapMixin, forms.ModelForm):
class Meta:
model = PowerOutlet
fields = [
'device', 'name', 'tags',
'device', 'name', 'description', 'tags',
]
widgets = {
'device': forms.HiddenInput(),
@ -1963,11 +1991,31 @@ class PowerOutletCreateForm(ComponentForm):
name_pattern = ExpandableNameField(
label='Name'
)
description = forms.CharField(
max_length=100,
required=False
)
tags = TagField(
required=False
)
class PowerOutletBulkEditForm(BootstrapMixin, AddRemoveTagsForm, BulkEditForm):
pk = forms.ModelMultipleChoiceField(
queryset=PowerOutlet.objects.all(),
widget=forms.MultipleHiddenInput()
)
description = forms.CharField(
max_length=100,
required=False
)
class Meta:
nullable_fields = [
'description',
]
class PowerOutletBulkRenameForm(BulkRenameForm):
pk = forms.ModelMultipleChoiceField(
queryset=PowerOutlet.objects.all(),
@ -2776,7 +2824,7 @@ class DeviceBayForm(BootstrapMixin, forms.ModelForm):
class Meta:
model = DeviceBay
fields = [
'device', 'name', 'tags',
'device', 'name', 'description', 'tags',
]
widgets = {
'device': forms.HiddenInput(),