mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 10:58:37 -06:00
Fix PowerPort connected_endpoint filtering, ordering
This commit is contained in:
parent
f8447989f2
commit
d6e3c922ed
@ -429,8 +429,8 @@ class PowerPortSerializer(TaggitSerializer, ConnectedEndpointSerializer):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = PowerPort
|
model = PowerPort
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'device', 'name', 'maximum_draw', 'allocated_draw', 'description', 'connected_endpoint_type', 'connected_endpoint', 'connection_status',
|
'id', 'device', 'name', 'maximum_draw', 'allocated_draw', 'description', 'connected_endpoint_type',
|
||||||
'cable', 'tags',
|
'connected_endpoint', 'connection_status', 'cable', 'tags',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -1025,14 +1025,14 @@ class PowerConnectionFilter(django_filters.FilterSet):
|
|||||||
def filter_site(self, queryset, name, value):
|
def filter_site(self, queryset, name, value):
|
||||||
if not value.strip():
|
if not value.strip():
|
||||||
return queryset
|
return queryset
|
||||||
return queryset.filter(connected_endpoint__device__site__slug=value)
|
return queryset.filter(_connected_poweroutlet__device__site__slug=value)
|
||||||
|
|
||||||
def filter_device(self, queryset, name, value):
|
def filter_device(self, queryset, name, value):
|
||||||
if not value.strip():
|
if not value.strip():
|
||||||
return queryset
|
return queryset
|
||||||
return queryset.filter(
|
return queryset.filter(
|
||||||
Q(device__name__icontains=value) |
|
Q(device__name__icontains=value) |
|
||||||
Q(connected_endpoint__device__name__icontains=value)
|
Q(_connected_poweroutlet__device__name__icontains=value)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -707,7 +707,8 @@ class PowerConnectionTable(BaseTable):
|
|||||||
args=[Accessor('connected_endpoint.device.pk')],
|
args=[Accessor('connected_endpoint.device.pk')],
|
||||||
verbose_name='PDU'
|
verbose_name='PDU'
|
||||||
)
|
)
|
||||||
connected_endpoint = tables.Column(
|
outlet = tables.Column(
|
||||||
|
accessor=Accessor('_connected_poweroutlet'),
|
||||||
verbose_name='Outlet'
|
verbose_name='Outlet'
|
||||||
)
|
)
|
||||||
device = tables.LinkColumn(
|
device = tables.LinkColumn(
|
||||||
@ -720,7 +721,7 @@ class PowerConnectionTable(BaseTable):
|
|||||||
|
|
||||||
class Meta(BaseTable.Meta):
|
class Meta(BaseTable.Meta):
|
||||||
model = PowerPort
|
model = PowerPort
|
||||||
fields = ('pdu', 'connected_endpoint', 'device', 'name', 'connection_status')
|
fields = ('pdu', 'outlet', 'device', 'name', 'connection_status')
|
||||||
|
|
||||||
|
|
||||||
class InterfaceConnectionTable(BaseTable):
|
class InterfaceConnectionTable(BaseTable):
|
||||||
|
Loading…
Reference in New Issue
Block a user