mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 03:56:53 -06:00
For #18352, adds PowerOutlet.status field to forms and filtersets
This commit is contained in:
parent
dbac09349b
commit
d9d7955c19
@ -1591,11 +1591,15 @@ class PowerOutletFilterSet(
|
|||||||
queryset=PowerPort.objects.all(),
|
queryset=PowerPort.objects.all(),
|
||||||
label=_('Power port (ID)'),
|
label=_('Power port (ID)'),
|
||||||
)
|
)
|
||||||
|
status = django_filters.MultipleChoiceFilter(
|
||||||
|
choices=PowerOutletStatusChoices,
|
||||||
|
null_value=None
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = PowerOutlet
|
model = PowerOutlet
|
||||||
fields = (
|
fields = (
|
||||||
'id', 'name', 'label', 'feed_leg', 'description', 'color', 'mark_connected', 'cable_end',
|
'id', 'name', 'status', 'label', 'feed_leg', 'description', 'color', 'mark_connected', 'cable_end',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1379,7 +1379,10 @@ class PowerPortBulkEditForm(
|
|||||||
|
|
||||||
class PowerOutletBulkEditForm(
|
class PowerOutletBulkEditForm(
|
||||||
ComponentBulkEditForm,
|
ComponentBulkEditForm,
|
||||||
form_from_model(PowerOutlet, ['label', 'type', 'color', 'feed_leg', 'power_port', 'mark_connected', 'description'])
|
form_from_model(
|
||||||
|
PowerOutlet,
|
||||||
|
['label', 'type', 'status', 'color', 'feed_leg', 'power_port', 'mark_connected', 'description']
|
||||||
|
)
|
||||||
):
|
):
|
||||||
mark_connected = forms.NullBooleanField(
|
mark_connected = forms.NullBooleanField(
|
||||||
label=_('Mark connected'),
|
label=_('Mark connected'),
|
||||||
@ -1389,7 +1392,7 @@ class PowerOutletBulkEditForm(
|
|||||||
|
|
||||||
model = PowerOutlet
|
model = PowerOutlet
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('module', 'type', 'label', 'description', 'mark_connected', 'color'),
|
FieldSet('module', 'type', 'label', 'status', 'description', 'mark_connected', 'color'),
|
||||||
FieldSet('feed_leg', 'power_port', name=_('Power')),
|
FieldSet('feed_leg', 'power_port', name=_('Power')),
|
||||||
)
|
)
|
||||||
nullable_fields = ('module', 'label', 'type', 'feed_leg', 'power_port', 'description')
|
nullable_fields = ('module', 'label', 'type', 'feed_leg', 'power_port', 'description')
|
||||||
|
@ -1305,7 +1305,7 @@ class PowerOutletFilterForm(PathEndpointFilterForm, DeviceComponentFilterForm):
|
|||||||
model = PowerOutlet
|
model = PowerOutlet
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag'),
|
FieldSet('q', 'filter_id', 'tag'),
|
||||||
FieldSet('name', 'label', 'type', 'color', name=_('Attributes')),
|
FieldSet('name', 'label', 'type', 'color', 'status', name=_('Attributes')),
|
||||||
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id', name=_('Location')),
|
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id', name=_('Location')),
|
||||||
FieldSet(
|
FieldSet(
|
||||||
'device_type_id', 'device_role_id', 'device_id', 'device_status', 'virtual_chassis_id',
|
'device_type_id', 'device_role_id', 'device_id', 'device_status', 'virtual_chassis_id',
|
||||||
@ -1323,6 +1323,11 @@ class PowerOutletFilterForm(PathEndpointFilterForm, DeviceComponentFilterForm):
|
|||||||
label=_('Color'),
|
label=_('Color'),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
|
status = forms.MultipleChoiceField(
|
||||||
|
label=_('Status'),
|
||||||
|
choices=PowerOutletStatusChoices,
|
||||||
|
required=False
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class InterfaceFilterForm(PathEndpointFilterForm, DeviceComponentFilterForm):
|
class InterfaceFilterForm(PathEndpointFilterForm, DeviceComponentFilterForm):
|
||||||
|
@ -1308,7 +1308,7 @@ class PowerOutletForm(ModularDeviceComponentForm):
|
|||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet(
|
FieldSet(
|
||||||
'device', 'module', 'name', 'label', 'type', 'color', 'power_port', 'feed_leg', 'mark_connected',
|
'device', 'module', 'name', 'label', 'type', 'status', 'color', 'power_port', 'feed_leg', 'mark_connected',
|
||||||
'description', 'tags',
|
'description', 'tags',
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -1316,7 +1316,7 @@ class PowerOutletForm(ModularDeviceComponentForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = PowerOutlet
|
model = PowerOutlet
|
||||||
fields = [
|
fields = [
|
||||||
'device', 'module', 'name', 'label', 'type', 'color', 'power_port', 'feed_leg', 'mark_connected',
|
'device', 'module', 'name', 'label', 'type', 'status', 'color', 'power_port', 'feed_leg', 'mark_connected',
|
||||||
'description', 'tags',
|
'description', 'tags',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user