mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-23 16:06:43 -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:
|
||||
model = ConsolePort
|
||||
fields = [
|
||||
@ -1191,6 +1197,12 @@ class ConsoleServerPortForm(NetBoxModelForm):
|
||||
}
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
(None, (
|
||||
'device', 'module', 'name', 'label', 'type', 'speed', 'mark_connected', 'description', 'tags',
|
||||
)),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = ConsoleServerPort
|
||||
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:
|
||||
model = PowerPort
|
||||
fields = [
|
||||
'device', 'module', 'name', 'label', 'type', 'maximum_draw', 'allocated_draw', 'mark_connected',
|
||||
'description',
|
||||
'tags',
|
||||
'description', 'tags',
|
||||
]
|
||||
widgets = {
|
||||
'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:
|
||||
model = PowerOutlet
|
||||
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:
|
||||
model = FrontPort
|
||||
fields = [
|
||||
@ -1426,6 +1458,12 @@ class RearPortForm(NetBoxModelForm):
|
||||
}
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
(None, (
|
||||
'device', 'module', 'name', 'label', 'type', 'color', 'positions', 'mark_connected', 'description', 'tags',
|
||||
)),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = RearPort
|
||||
fields = [
|
||||
@ -1441,6 +1479,10 @@ class ModuleBayForm(NetBoxModelForm):
|
||||
queryset=Device.objects.all()
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
(None, ('device', 'name', 'label', 'position', 'description', 'tags',)),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = ModuleBay
|
||||
fields = [
|
||||
@ -1453,6 +1495,10 @@ class DeviceBayForm(NetBoxModelForm):
|
||||
queryset=Device.objects.all()
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
(None, ('device', 'name', 'label', 'description', 'tags',)),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = DeviceBay
|
||||
fields = [
|
||||
|
@ -206,35 +206,30 @@ class InventoryItemTemplateCreateForm(ComponentCreateForm, model_forms.Inventory
|
||||
#
|
||||
|
||||
class ConsolePortCreateForm(ComponentCreateForm, model_forms.ConsolePortForm):
|
||||
field_order = ('device', 'name', 'label')
|
||||
|
||||
class Meta(model_forms.ConsolePortForm.Meta):
|
||||
exclude = ('name', 'label')
|
||||
|
||||
|
||||
class ConsoleServerPortCreateForm(ComponentCreateForm, model_forms.ConsoleServerPortForm):
|
||||
field_order = ('device', 'name', 'label')
|
||||
|
||||
class Meta(model_forms.ConsoleServerPortForm.Meta):
|
||||
exclude = ('name', 'label')
|
||||
|
||||
|
||||
class PowerPortCreateForm(ComponentCreateForm, model_forms.PowerPortForm):
|
||||
field_order = ('device', 'name', 'label')
|
||||
|
||||
class Meta(model_forms.PowerPortForm.Meta):
|
||||
exclude = ('name', 'label')
|
||||
|
||||
|
||||
class PowerOutletCreateForm(ComponentCreateForm, model_forms.PowerOutletForm):
|
||||
field_order = ('device', 'name', 'label')
|
||||
|
||||
class Meta(model_forms.PowerOutletForm.Meta):
|
||||
exclude = ('name', 'label')
|
||||
|
||||
|
||||
class InterfaceCreateForm(ComponentCreateForm, model_forms.InterfaceForm):
|
||||
field_order = ('device', 'name', 'label')
|
||||
|
||||
class Meta(model_forms.InterfaceForm.Meta):
|
||||
exclude = ('name', 'label')
|
||||
@ -246,7 +241,12 @@ class FrontPortCreateForm(ComponentCreateForm, model_forms.FrontPortForm):
|
||||
label='Rear ports',
|
||||
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):
|
||||
exclude = ('name', 'label', 'rear_port', 'rear_port_position')
|
||||
@ -288,14 +288,12 @@ class FrontPortCreateForm(ComponentCreateForm, model_forms.FrontPortForm):
|
||||
|
||||
|
||||
class RearPortCreateForm(ComponentCreateForm, model_forms.RearPortForm):
|
||||
field_order = ('device', 'name', 'label')
|
||||
|
||||
class Meta(model_forms.RearPortForm.Meta):
|
||||
exclude = ('name', 'label')
|
||||
|
||||
|
||||
class DeviceBayCreateForm(ComponentCreateForm, model_forms.DeviceBayForm):
|
||||
field_order = ('device', 'name', 'label')
|
||||
|
||||
class Meta(model_forms.DeviceBayForm.Meta):
|
||||
exclude = ('name', 'label')
|
||||
@ -307,7 +305,6 @@ class ModuleBayCreateForm(ComponentCreateForm, model_forms.ModuleBayForm):
|
||||
required=False,
|
||||
help_text='Alphanumeric ranges are supported. (Must match the number of names being created.)'
|
||||
)
|
||||
field_order = ('device', 'name', 'label')
|
||||
replication_fields = ('name', 'label', 'position')
|
||||
|
||||
class Meta(model_forms.ModuleBayForm.Meta):
|
||||
@ -315,7 +312,6 @@ class ModuleBayCreateForm(ComponentCreateForm, model_forms.ModuleBayForm):
|
||||
|
||||
|
||||
class InventoryItemCreateForm(ComponentCreateForm, model_forms.InventoryItemForm):
|
||||
field_order = ('device', 'name', 'label')
|
||||
|
||||
class Meta(model_forms.InventoryItemForm.Meta):
|
||||
exclude = ('name', 'label')
|
||||
|
@ -1862,7 +1862,6 @@ class ConsolePortCreateView(generic.ComponentCreateView):
|
||||
class ConsolePortEditView(generic.ObjectEditView):
|
||||
queryset = ConsolePort.objects.all()
|
||||
form = forms.ConsolePortForm
|
||||
template_name = 'dcim/device_component_edit.html'
|
||||
|
||||
|
||||
class ConsolePortDeleteView(generic.ObjectDeleteView):
|
||||
@ -1921,7 +1920,6 @@ class ConsoleServerPortCreateView(generic.ComponentCreateView):
|
||||
class ConsoleServerPortEditView(generic.ObjectEditView):
|
||||
queryset = ConsoleServerPort.objects.all()
|
||||
form = forms.ConsoleServerPortForm
|
||||
template_name = 'dcim/device_component_edit.html'
|
||||
|
||||
|
||||
class ConsoleServerPortDeleteView(generic.ObjectDeleteView):
|
||||
@ -1980,7 +1978,6 @@ class PowerPortCreateView(generic.ComponentCreateView):
|
||||
class PowerPortEditView(generic.ObjectEditView):
|
||||
queryset = PowerPort.objects.all()
|
||||
form = forms.PowerPortForm
|
||||
template_name = 'dcim/device_component_edit.html'
|
||||
|
||||
|
||||
class PowerPortDeleteView(generic.ObjectDeleteView):
|
||||
@ -2039,7 +2036,6 @@ class PowerOutletCreateView(generic.ComponentCreateView):
|
||||
class PowerOutletEditView(generic.ObjectEditView):
|
||||
queryset = PowerOutlet.objects.all()
|
||||
form = forms.PowerOutletForm
|
||||
template_name = 'dcim/device_component_edit.html'
|
||||
|
||||
|
||||
class PowerOutletDeleteView(generic.ObjectDeleteView):
|
||||
@ -2200,7 +2196,6 @@ class FrontPortCreateView(generic.ComponentCreateView):
|
||||
class FrontPortEditView(generic.ObjectEditView):
|
||||
queryset = FrontPort.objects.all()
|
||||
form = forms.FrontPortForm
|
||||
template_name = 'dcim/device_component_edit.html'
|
||||
|
||||
|
||||
class FrontPortDeleteView(generic.ObjectDeleteView):
|
||||
@ -2259,7 +2254,6 @@ class RearPortCreateView(generic.ComponentCreateView):
|
||||
class RearPortEditView(generic.ObjectEditView):
|
||||
queryset = RearPort.objects.all()
|
||||
form = forms.RearPortForm
|
||||
template_name = 'dcim/device_component_edit.html'
|
||||
|
||||
|
||||
class RearPortDeleteView(generic.ObjectDeleteView):
|
||||
@ -2318,7 +2312,6 @@ class ModuleBayCreateView(generic.ComponentCreateView):
|
||||
class ModuleBayEditView(generic.ObjectEditView):
|
||||
queryset = ModuleBay.objects.all()
|
||||
form = forms.ModuleBayForm
|
||||
template_name = 'dcim/device_component_edit.html'
|
||||
|
||||
|
||||
class ModuleBayDeleteView(generic.ObjectDeleteView):
|
||||
@ -2373,7 +2366,6 @@ class DeviceBayCreateView(generic.ComponentCreateView):
|
||||
class DeviceBayEditView(generic.ObjectEditView):
|
||||
queryset = DeviceBay.objects.all()
|
||||
form = forms.DeviceBayForm
|
||||
template_name = 'dcim/device_component_edit.html'
|
||||
|
||||
|
||||
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