mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-24 00:15:17 -06:00
Clean up ordering of fields in component creation forms
This commit is contained in:
parent
21fe202597
commit
5888038996
@ -1168,6 +1168,12 @@ class ConsolePortForm(NetBoxModelForm):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fieldsets = (
|
||||||
|
(None, (
|
||||||
|
'device', 'module', 'name', 'label', 'type', 'speed', 'mark_connected', 'description', 'tags',
|
||||||
|
)),
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ConsolePort
|
model = ConsolePort
|
||||||
fields = [
|
fields = [
|
||||||
@ -1191,6 +1197,12 @@ class ConsoleServerPortForm(NetBoxModelForm):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fieldsets = (
|
||||||
|
(None, (
|
||||||
|
'device', 'module', 'name', 'label', 'type', 'speed', 'mark_connected', 'description', 'tags',
|
||||||
|
)),
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ConsoleServerPort
|
model = ConsoleServerPort
|
||||||
fields = [
|
fields = [
|
||||||
@ -1214,12 +1226,18 @@ class PowerPortForm(NetBoxModelForm):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fieldsets = (
|
||||||
|
(None, (
|
||||||
|
'device', 'module', 'name', 'label', 'type', 'maximum_draw', 'allocated_draw', 'mark_connected',
|
||||||
|
'description', 'tags',
|
||||||
|
)),
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = PowerPort
|
model = PowerPort
|
||||||
fields = [
|
fields = [
|
||||||
'device', 'module', 'name', 'label', 'type', 'maximum_draw', 'allocated_draw', 'mark_connected',
|
'device', 'module', 'name', 'label', 'type', 'maximum_draw', 'allocated_draw', 'mark_connected',
|
||||||
'description',
|
'description', 'tags',
|
||||||
'tags',
|
|
||||||
]
|
]
|
||||||
widgets = {
|
widgets = {
|
||||||
'type': StaticSelect(),
|
'type': StaticSelect(),
|
||||||
@ -1245,6 +1263,13 @@ class PowerOutletForm(NetBoxModelForm):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fieldsets = (
|
||||||
|
(None, (
|
||||||
|
'device', 'module', 'name', 'label', 'type', 'power_port', 'feed_leg', 'mark_connected', 'description',
|
||||||
|
'tags',
|
||||||
|
)),
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = PowerOutlet
|
model = PowerOutlet
|
||||||
fields = [
|
fields = [
|
||||||
@ -1403,6 +1428,13 @@ class FrontPortForm(NetBoxModelForm):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fieldsets = (
|
||||||
|
(None, (
|
||||||
|
'device', 'module', 'name', 'label', 'type', 'color', 'rear_port', 'rear_port_position', 'mark_connected',
|
||||||
|
'description', 'tags',
|
||||||
|
)),
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = FrontPort
|
model = FrontPort
|
||||||
fields = [
|
fields = [
|
||||||
@ -1426,6 +1458,12 @@ class RearPortForm(NetBoxModelForm):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fieldsets = (
|
||||||
|
(None, (
|
||||||
|
'device', 'module', 'name', 'label', 'type', 'color', 'positions', 'mark_connected', 'description', 'tags',
|
||||||
|
)),
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = RearPort
|
model = RearPort
|
||||||
fields = [
|
fields = [
|
||||||
@ -1441,6 +1479,10 @@ class ModuleBayForm(NetBoxModelForm):
|
|||||||
queryset=Device.objects.all()
|
queryset=Device.objects.all()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fieldsets = (
|
||||||
|
(None, ('device', 'name', 'label', 'position', 'description', 'tags',)),
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ModuleBay
|
model = ModuleBay
|
||||||
fields = [
|
fields = [
|
||||||
@ -1453,6 +1495,10 @@ class DeviceBayForm(NetBoxModelForm):
|
|||||||
queryset=Device.objects.all()
|
queryset=Device.objects.all()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fieldsets = (
|
||||||
|
(None, ('device', 'name', 'label', 'description', 'tags',)),
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = DeviceBay
|
model = DeviceBay
|
||||||
fields = [
|
fields = [
|
||||||
|
@ -206,35 +206,30 @@ class InventoryItemTemplateCreateForm(ComponentCreateForm, model_forms.Inventory
|
|||||||
#
|
#
|
||||||
|
|
||||||
class ConsolePortCreateForm(ComponentCreateForm, model_forms.ConsolePortForm):
|
class ConsolePortCreateForm(ComponentCreateForm, model_forms.ConsolePortForm):
|
||||||
field_order = ('device', 'name', 'label')
|
|
||||||
|
|
||||||
class Meta(model_forms.ConsolePortForm.Meta):
|
class Meta(model_forms.ConsolePortForm.Meta):
|
||||||
exclude = ('name', 'label')
|
exclude = ('name', 'label')
|
||||||
|
|
||||||
|
|
||||||
class ConsoleServerPortCreateForm(ComponentCreateForm, model_forms.ConsoleServerPortForm):
|
class ConsoleServerPortCreateForm(ComponentCreateForm, model_forms.ConsoleServerPortForm):
|
||||||
field_order = ('device', 'name', 'label')
|
|
||||||
|
|
||||||
class Meta(model_forms.ConsoleServerPortForm.Meta):
|
class Meta(model_forms.ConsoleServerPortForm.Meta):
|
||||||
exclude = ('name', 'label')
|
exclude = ('name', 'label')
|
||||||
|
|
||||||
|
|
||||||
class PowerPortCreateForm(ComponentCreateForm, model_forms.PowerPortForm):
|
class PowerPortCreateForm(ComponentCreateForm, model_forms.PowerPortForm):
|
||||||
field_order = ('device', 'name', 'label')
|
|
||||||
|
|
||||||
class Meta(model_forms.PowerPortForm.Meta):
|
class Meta(model_forms.PowerPortForm.Meta):
|
||||||
exclude = ('name', 'label')
|
exclude = ('name', 'label')
|
||||||
|
|
||||||
|
|
||||||
class PowerOutletCreateForm(ComponentCreateForm, model_forms.PowerOutletForm):
|
class PowerOutletCreateForm(ComponentCreateForm, model_forms.PowerOutletForm):
|
||||||
field_order = ('device', 'name', 'label')
|
|
||||||
|
|
||||||
class Meta(model_forms.PowerOutletForm.Meta):
|
class Meta(model_forms.PowerOutletForm.Meta):
|
||||||
exclude = ('name', 'label')
|
exclude = ('name', 'label')
|
||||||
|
|
||||||
|
|
||||||
class InterfaceCreateForm(ComponentCreateForm, model_forms.InterfaceForm):
|
class InterfaceCreateForm(ComponentCreateForm, model_forms.InterfaceForm):
|
||||||
field_order = ('device', 'name', 'label')
|
|
||||||
|
|
||||||
class Meta(model_forms.InterfaceForm.Meta):
|
class Meta(model_forms.InterfaceForm.Meta):
|
||||||
exclude = ('name', 'label')
|
exclude = ('name', 'label')
|
||||||
@ -246,7 +241,12 @@ class FrontPortCreateForm(ComponentCreateForm, model_forms.FrontPortForm):
|
|||||||
label='Rear ports',
|
label='Rear ports',
|
||||||
help_text='Select one rear port assignment for each front port being created.',
|
help_text='Select one rear port assignment for each front port being created.',
|
||||||
)
|
)
|
||||||
field_order = ('device', 'module', 'name', 'label', 'type', 'color', 'rear_port')
|
|
||||||
|
fieldsets = (
|
||||||
|
(None, (
|
||||||
|
'device', 'module', 'name', 'label', 'type', 'color', 'rear_port', 'mark_connected', 'description', 'tags',
|
||||||
|
)),
|
||||||
|
)
|
||||||
|
|
||||||
class Meta(model_forms.FrontPortForm.Meta):
|
class Meta(model_forms.FrontPortForm.Meta):
|
||||||
exclude = ('name', 'label', 'rear_port', 'rear_port_position')
|
exclude = ('name', 'label', 'rear_port', 'rear_port_position')
|
||||||
@ -288,14 +288,12 @@ class FrontPortCreateForm(ComponentCreateForm, model_forms.FrontPortForm):
|
|||||||
|
|
||||||
|
|
||||||
class RearPortCreateForm(ComponentCreateForm, model_forms.RearPortForm):
|
class RearPortCreateForm(ComponentCreateForm, model_forms.RearPortForm):
|
||||||
field_order = ('device', 'name', 'label')
|
|
||||||
|
|
||||||
class Meta(model_forms.RearPortForm.Meta):
|
class Meta(model_forms.RearPortForm.Meta):
|
||||||
exclude = ('name', 'label')
|
exclude = ('name', 'label')
|
||||||
|
|
||||||
|
|
||||||
class DeviceBayCreateForm(ComponentCreateForm, model_forms.DeviceBayForm):
|
class DeviceBayCreateForm(ComponentCreateForm, model_forms.DeviceBayForm):
|
||||||
field_order = ('device', 'name', 'label')
|
|
||||||
|
|
||||||
class Meta(model_forms.DeviceBayForm.Meta):
|
class Meta(model_forms.DeviceBayForm.Meta):
|
||||||
exclude = ('name', 'label')
|
exclude = ('name', 'label')
|
||||||
@ -307,7 +305,6 @@ class ModuleBayCreateForm(ComponentCreateForm, model_forms.ModuleBayForm):
|
|||||||
required=False,
|
required=False,
|
||||||
help_text='Alphanumeric ranges are supported. (Must match the number of names being created.)'
|
help_text='Alphanumeric ranges are supported. (Must match the number of names being created.)'
|
||||||
)
|
)
|
||||||
field_order = ('device', 'name', 'label')
|
|
||||||
replication_fields = ('name', 'label', 'position')
|
replication_fields = ('name', 'label', 'position')
|
||||||
|
|
||||||
class Meta(model_forms.ModuleBayForm.Meta):
|
class Meta(model_forms.ModuleBayForm.Meta):
|
||||||
@ -315,7 +312,6 @@ class ModuleBayCreateForm(ComponentCreateForm, model_forms.ModuleBayForm):
|
|||||||
|
|
||||||
|
|
||||||
class InventoryItemCreateForm(ComponentCreateForm, model_forms.InventoryItemForm):
|
class InventoryItemCreateForm(ComponentCreateForm, model_forms.InventoryItemForm):
|
||||||
field_order = ('device', 'name', 'label')
|
|
||||||
|
|
||||||
class Meta(model_forms.InventoryItemForm.Meta):
|
class Meta(model_forms.InventoryItemForm.Meta):
|
||||||
exclude = ('name', 'label')
|
exclude = ('name', 'label')
|
||||||
|
@ -1862,7 +1862,6 @@ class ConsolePortCreateView(generic.ComponentCreateView):
|
|||||||
class ConsolePortEditView(generic.ObjectEditView):
|
class ConsolePortEditView(generic.ObjectEditView):
|
||||||
queryset = ConsolePort.objects.all()
|
queryset = ConsolePort.objects.all()
|
||||||
form = forms.ConsolePortForm
|
form = forms.ConsolePortForm
|
||||||
template_name = 'dcim/device_component_edit.html'
|
|
||||||
|
|
||||||
|
|
||||||
class ConsolePortDeleteView(generic.ObjectDeleteView):
|
class ConsolePortDeleteView(generic.ObjectDeleteView):
|
||||||
@ -1921,7 +1920,6 @@ class ConsoleServerPortCreateView(generic.ComponentCreateView):
|
|||||||
class ConsoleServerPortEditView(generic.ObjectEditView):
|
class ConsoleServerPortEditView(generic.ObjectEditView):
|
||||||
queryset = ConsoleServerPort.objects.all()
|
queryset = ConsoleServerPort.objects.all()
|
||||||
form = forms.ConsoleServerPortForm
|
form = forms.ConsoleServerPortForm
|
||||||
template_name = 'dcim/device_component_edit.html'
|
|
||||||
|
|
||||||
|
|
||||||
class ConsoleServerPortDeleteView(generic.ObjectDeleteView):
|
class ConsoleServerPortDeleteView(generic.ObjectDeleteView):
|
||||||
@ -1980,7 +1978,6 @@ class PowerPortCreateView(generic.ComponentCreateView):
|
|||||||
class PowerPortEditView(generic.ObjectEditView):
|
class PowerPortEditView(generic.ObjectEditView):
|
||||||
queryset = PowerPort.objects.all()
|
queryset = PowerPort.objects.all()
|
||||||
form = forms.PowerPortForm
|
form = forms.PowerPortForm
|
||||||
template_name = 'dcim/device_component_edit.html'
|
|
||||||
|
|
||||||
|
|
||||||
class PowerPortDeleteView(generic.ObjectDeleteView):
|
class PowerPortDeleteView(generic.ObjectDeleteView):
|
||||||
@ -2039,7 +2036,6 @@ class PowerOutletCreateView(generic.ComponentCreateView):
|
|||||||
class PowerOutletEditView(generic.ObjectEditView):
|
class PowerOutletEditView(generic.ObjectEditView):
|
||||||
queryset = PowerOutlet.objects.all()
|
queryset = PowerOutlet.objects.all()
|
||||||
form = forms.PowerOutletForm
|
form = forms.PowerOutletForm
|
||||||
template_name = 'dcim/device_component_edit.html'
|
|
||||||
|
|
||||||
|
|
||||||
class PowerOutletDeleteView(generic.ObjectDeleteView):
|
class PowerOutletDeleteView(generic.ObjectDeleteView):
|
||||||
@ -2200,7 +2196,6 @@ class FrontPortCreateView(generic.ComponentCreateView):
|
|||||||
class FrontPortEditView(generic.ObjectEditView):
|
class FrontPortEditView(generic.ObjectEditView):
|
||||||
queryset = FrontPort.objects.all()
|
queryset = FrontPort.objects.all()
|
||||||
form = forms.FrontPortForm
|
form = forms.FrontPortForm
|
||||||
template_name = 'dcim/device_component_edit.html'
|
|
||||||
|
|
||||||
|
|
||||||
class FrontPortDeleteView(generic.ObjectDeleteView):
|
class FrontPortDeleteView(generic.ObjectDeleteView):
|
||||||
@ -2259,7 +2254,6 @@ class RearPortCreateView(generic.ComponentCreateView):
|
|||||||
class RearPortEditView(generic.ObjectEditView):
|
class RearPortEditView(generic.ObjectEditView):
|
||||||
queryset = RearPort.objects.all()
|
queryset = RearPort.objects.all()
|
||||||
form = forms.RearPortForm
|
form = forms.RearPortForm
|
||||||
template_name = 'dcim/device_component_edit.html'
|
|
||||||
|
|
||||||
|
|
||||||
class RearPortDeleteView(generic.ObjectDeleteView):
|
class RearPortDeleteView(generic.ObjectDeleteView):
|
||||||
@ -2318,7 +2312,6 @@ class ModuleBayCreateView(generic.ComponentCreateView):
|
|||||||
class ModuleBayEditView(generic.ObjectEditView):
|
class ModuleBayEditView(generic.ObjectEditView):
|
||||||
queryset = ModuleBay.objects.all()
|
queryset = ModuleBay.objects.all()
|
||||||
form = forms.ModuleBayForm
|
form = forms.ModuleBayForm
|
||||||
template_name = 'dcim/device_component_edit.html'
|
|
||||||
|
|
||||||
|
|
||||||
class ModuleBayDeleteView(generic.ObjectDeleteView):
|
class ModuleBayDeleteView(generic.ObjectDeleteView):
|
||||||
@ -2373,7 +2366,6 @@ class DeviceBayCreateView(generic.ComponentCreateView):
|
|||||||
class DeviceBayEditView(generic.ObjectEditView):
|
class DeviceBayEditView(generic.ObjectEditView):
|
||||||
queryset = DeviceBay.objects.all()
|
queryset = DeviceBay.objects.all()
|
||||||
form = forms.DeviceBayForm
|
form = forms.DeviceBayForm
|
||||||
template_name = 'dcim/device_component_edit.html'
|
|
||||||
|
|
||||||
|
|
||||||
class DeviceBayDeleteView(generic.ObjectDeleteView):
|
class DeviceBayDeleteView(generic.ObjectDeleteView):
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
{% extends 'generic/object_edit.html' %}
|
|
||||||
{% load form_helpers %}
|
|
||||||
|
|
||||||
{% block form %}
|
|
||||||
<div class="field-group mb-5">
|
|
||||||
{% if form.instance.device %}
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-sm-3 col-form-label text-lg-end">Device</label>
|
|
||||||
<div class="col">
|
|
||||||
<input class="form-control" value="{{ form.instance.device }}" disabled />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% render_form form %}
|
|
||||||
</div>
|
|
||||||
{% endblock form %}
|
|
Loading…
Reference in New Issue
Block a user