mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Export only visible columns
This commit is contained in:
@ -181,10 +181,14 @@ class ObjectListView(ObjectPermissionRequiredMixin, View):
|
|||||||
|
|
||||||
# Handle table-based export
|
# Handle table-based export
|
||||||
if request.GET.get('export') == 'table':
|
if request.GET.get('export') == 'table':
|
||||||
|
exclude_columns = {'pk'}
|
||||||
|
exclude_columns.update({
|
||||||
|
col for col in table.base_columns if col not in table.visible_columns
|
||||||
|
})
|
||||||
exporter = TableExport(
|
exporter = TableExport(
|
||||||
export_format=TableExport.CSV,
|
export_format=TableExport.CSV,
|
||||||
table=table,
|
table=table,
|
||||||
exclude_columns=['pk'],
|
exclude_columns=exclude_columns,
|
||||||
dataset_kwargs={},
|
dataset_kwargs={},
|
||||||
)
|
)
|
||||||
return exporter.response(
|
return exporter.response(
|
||||||
|
Reference in New Issue
Block a user