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

Add bulk edit views for DeviceType components

This commit is contained in:
Jeremy Stretch
2020-02-06 15:29:10 -05:00
parent 077d692d6d
commit 3378287b0c
5 changed files with 172 additions and 7 deletions

View File

@@ -1058,6 +1058,20 @@ class ConsolePortTemplateCreateForm(BootstrapMixin, forms.Form):
)
class ConsolePortTemplateBulkEditForm(BootstrapMixin, BulkEditForm):
pk = forms.ModelMultipleChoiceField(
queryset=ConsolePortTemplate.objects.all(),
widget=forms.MultipleHiddenInput()
)
type = forms.ChoiceField(
choices=add_blank_choice(ConsolePortTypeChoices),
widget=StaticSelect2()
)
class Meta:
nullable_fields = ('type',)
class ConsoleServerPortTemplateForm(BootstrapMixin, forms.ModelForm):
class Meta:
@@ -1086,6 +1100,20 @@ class ConsoleServerPortTemplateCreateForm(BootstrapMixin, forms.Form):
)
class ConsoleServerPortTemplateBulkEditForm(BootstrapMixin, BulkEditForm):
pk = forms.ModelMultipleChoiceField(
queryset=ConsoleServerPortTemplate.objects.all(),
widget=forms.MultipleHiddenInput()
)
type = forms.ChoiceField(
choices=add_blank_choice(ConsolePortTypeChoices),
widget=StaticSelect2()
)
class Meta:
nullable_fields = ('type',)
class PowerPortTemplateForm(BootstrapMixin, forms.ModelForm):
class Meta:
@@ -1124,6 +1152,30 @@ class PowerPortTemplateCreateForm(BootstrapMixin, forms.Form):
)
class PowerPortTemplateBulkEditForm(BootstrapMixin, BulkEditForm):
pk = forms.ModelMultipleChoiceField(
queryset=PowerPortTemplate.objects.all(),
widget=forms.MultipleHiddenInput()
)
type = forms.ChoiceField(
choices=add_blank_choice(PowerPortTypeChoices),
required=False
)
maximum_draw = forms.IntegerField(
min_value=1,
required=False,
help_text="Maximum power draw (watts)"
)
allocated_draw = forms.IntegerField(
min_value=1,
required=False,
help_text="Allocated power draw (watts)"
)
class Meta:
nullable_fields = ('type', 'maximum_draw', 'allocated_draw')
class PowerOutletTemplateForm(BootstrapMixin, forms.ModelForm):
class Meta:
@@ -1182,6 +1234,25 @@ class PowerOutletTemplateCreateForm(BootstrapMixin, forms.Form):
)
class PowerOutletTemplateBulkEditForm(BootstrapMixin, BulkEditForm):
pk = forms.ModelMultipleChoiceField(
queryset=PowerOutletTemplate.objects.all(),
widget=forms.MultipleHiddenInput()
)
type = forms.ChoiceField(
choices=add_blank_choice(PowerOutletTypeChoices),
required=False
)
feed_leg = forms.ChoiceField(
choices=add_blank_choice(PowerOutletFeedLegChoices),
required=False,
widget=StaticSelect2()
)
class Meta:
nullable_fields = ('type', 'feed_leg')
class InterfaceTemplateForm(BootstrapMixin, forms.ModelForm):
class Meta:
@@ -1324,6 +1395,20 @@ class FrontPortTemplateCreateForm(BootstrapMixin, forms.Form):
}
class FrontPortTemplateBulkEditForm(BootstrapMixin, BulkEditForm):
pk = forms.ModelMultipleChoiceField(
queryset=FrontPortTemplate.objects.all(),
widget=forms.MultipleHiddenInput()
)
type = forms.ChoiceField(
choices=PortTypeChoices,
widget=StaticSelect2()
)
class Meta:
nullable_fields = ('type',)
class RearPortTemplateForm(BootstrapMixin, forms.ModelForm):
class Meta:
@@ -1359,6 +1444,20 @@ class RearPortTemplateCreateForm(BootstrapMixin, forms.Form):
)
class RearPortTemplateBulkEditForm(BootstrapMixin, BulkEditForm):
pk = forms.ModelMultipleChoiceField(
queryset=RearPortTemplate.objects.all(),
widget=forms.MultipleHiddenInput()
)
type = forms.ChoiceField(
choices=PortTypeChoices,
widget=StaticSelect2()
)
class Meta:
nullable_fields = ('type',)
class DeviceBayTemplateForm(BootstrapMixin, forms.ModelForm):
class Meta:
@@ -1383,6 +1482,16 @@ class DeviceBayTemplateCreateForm(BootstrapMixin, forms.Form):
)
# class DeviceBayTemplateBulkEditForm(BootstrapMixin, BulkEditForm):
# pk = forms.ModelMultipleChoiceField(
# queryset=FrontPortTemplate.objects.all(),
# widget=forms.MultipleHiddenInput()
# )
#
# class Meta:
# nullable_fields = ()
#
# Component template import forms
#