mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-02 15:37:18 +02:00
Tweak behavior of include_columns
This commit is contained in:
@@ -187,12 +187,11 @@ class BaseTable(tables.Table):
|
||||
self._set_columns(columns)
|
||||
|
||||
# Apply column inclusion/exclusion (overrides user preferences)
|
||||
if include_columns := request.GET.get('include_columns'):
|
||||
include_columns = include_columns.split(',')
|
||||
for column in self.columns:
|
||||
if column.name not in self.exempt_columns and column.name not in include_columns:
|
||||
self.columns.hide(column.name)
|
||||
elif exclude_columns := request.GET.get('exclude_columns'):
|
||||
if columns_param := request.GET.get('include_columns'):
|
||||
for column_name in columns_param.split(','):
|
||||
if column_name in self.columns.names():
|
||||
self.columns.show(column_name)
|
||||
if exclude_columns := request.GET.get('exclude_columns'):
|
||||
exclude_columns = exclude_columns.split(',')
|
||||
for column_name in exclude_columns:
|
||||
if column_name in self.columns.names() and column_name not in self.exempt_columns:
|
||||
|
||||
@@ -282,7 +282,7 @@ class ObjectsTablePanel(Panel):
|
||||
model (str): The dotted label of the model to be added (e.g. "dcim.site")
|
||||
filters (dict): A dictionary of arbitrary URL parameters to append to the table's URL. If the value of a key is
|
||||
a callable, it will be passed the current template context.
|
||||
include_columns (list): A list of column names to display exclusively (overrides user preferences)
|
||||
include_columns (list): A list of column names to always display (overrides user preferences)
|
||||
exclude_columns (list): A list of column names to hide from the table (overrides user preferences)
|
||||
"""
|
||||
template_name = 'ui/panels/objects_table.html'
|
||||
|
||||
Reference in New Issue
Block a user