mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
Fixes #8671: Fix AttributeError when viewing console/power/interface connection lists
This commit is contained in:
parent
bcdd006dd5
commit
90558a2e80
@ -149,6 +149,7 @@ Where it is desired to limit the range of available VLANs within a group, users
|
|||||||
* [#8655](https://github.com/netbox-community/netbox/issues/8655) - Fix AttributeError when viewing cabled interfaces
|
* [#8655](https://github.com/netbox-community/netbox/issues/8655) - Fix AttributeError when viewing cabled interfaces
|
||||||
* [#8659](https://github.com/netbox-community/netbox/issues/8659) - Fix display of multi-object custom fields after deleting related object
|
* [#8659](https://github.com/netbox-community/netbox/issues/8659) - Fix display of multi-object custom fields after deleting related object
|
||||||
* [#8661](https://github.com/netbox-community/netbox/issues/8661) - Fix ValueError exception when trying to connect a cable
|
* [#8661](https://github.com/netbox-community/netbox/issues/8661) - Fix ValueError exception when trying to connect a cable
|
||||||
|
* [#8671](https://github.com/netbox-community/netbox/issues/8671) - Fix AttributeError when viewing console/power/interface connection lists
|
||||||
|
|
||||||
### Other Changes
|
### Other Changes
|
||||||
|
|
||||||
|
@ -127,6 +127,30 @@ class BaseTable(tables.Table):
|
|||||||
self._objects_count = sum(1 for obj in self.data if hasattr(obj, 'pk'))
|
self._objects_count = sum(1 for obj in self.data if hasattr(obj, 'pk'))
|
||||||
return self._objects_count
|
return self._objects_count
|
||||||
|
|
||||||
|
def configure(self, request):
|
||||||
|
"""
|
||||||
|
Configure the table for a specific request context. This performs pagination and records
|
||||||
|
the user's preferred ordering logic.
|
||||||
|
"""
|
||||||
|
# Save ordering preference
|
||||||
|
if request.user.is_authenticated:
|
||||||
|
table_name = self.__class__.__name__
|
||||||
|
if self.prefixed_order_by_field in request.GET:
|
||||||
|
# If an ordering has been specified as a query parameter, save it as the
|
||||||
|
# user's preferred ordering for this table.
|
||||||
|
ordering = request.GET.getlist(self.prefixed_order_by_field)
|
||||||
|
request.user.config.set(f'tables.{table_name}.ordering', ordering, commit=True)
|
||||||
|
elif ordering := request.user.config.get(f'tables.{table_name}.ordering'):
|
||||||
|
# If no ordering has been specified, set the preferred ordering (if any).
|
||||||
|
self.order_by = ordering
|
||||||
|
|
||||||
|
# Paginate the table results
|
||||||
|
paginate = {
|
||||||
|
'paginator_class': EnhancedPaginator,
|
||||||
|
'per_page': get_paginate_count(request)
|
||||||
|
}
|
||||||
|
tables.RequestConfig(request, paginate).configure(self)
|
||||||
|
|
||||||
|
|
||||||
class NetBoxTable(BaseTable):
|
class NetBoxTable(BaseTable):
|
||||||
"""
|
"""
|
||||||
@ -167,27 +191,3 @@ class NetBoxTable(BaseTable):
|
|||||||
])
|
])
|
||||||
|
|
||||||
super().__init__(*args, extra_columns=extra_columns, **kwargs)
|
super().__init__(*args, extra_columns=extra_columns, **kwargs)
|
||||||
|
|
||||||
def configure(self, request):
|
|
||||||
"""
|
|
||||||
Configure the table for a specific request context. This performs pagination and records
|
|
||||||
the user's preferred ordering logic.
|
|
||||||
"""
|
|
||||||
# Save ordering preference
|
|
||||||
if request.user.is_authenticated:
|
|
||||||
table_name = self.__class__.__name__
|
|
||||||
if self.prefixed_order_by_field in request.GET:
|
|
||||||
# If an ordering has been specified as a query parameter, save it as the
|
|
||||||
# user's preferred ordering for this table.
|
|
||||||
ordering = request.GET.getlist(self.prefixed_order_by_field)
|
|
||||||
request.user.config.set(f'tables.{table_name}.ordering', ordering, commit=True)
|
|
||||||
elif ordering := request.user.config.get(f'tables.{table_name}.ordering'):
|
|
||||||
# If no ordering has been specified, set the preferred ordering (if any).
|
|
||||||
self.order_by = ordering
|
|
||||||
|
|
||||||
# Paginate the table results
|
|
||||||
paginate = {
|
|
||||||
'paginator_class': EnhancedPaginator,
|
|
||||||
'per_page': get_paginate_count(request)
|
|
||||||
}
|
|
||||||
tables.RequestConfig(request, paginate).configure(self)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user