mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-20 20:32:25 -06:00
Update BaseTable to accept user instance directly
This commit is contained in:
@@ -289,12 +289,8 @@ class ObjectListView(ObjectPermissionRequiredMixin, View):
|
||||
perm_name = get_permission_for_model(model, action)
|
||||
permissions[action] = request.user.has_perm(perm_name)
|
||||
|
||||
# Construct the table based on the user's permissions
|
||||
if request.user.is_authenticated:
|
||||
columns = request.user.config.get(f"tables.{self.table.__name__}.columns")
|
||||
else:
|
||||
columns = None
|
||||
table = self.table(self.queryset, columns=columns)
|
||||
# Construct the objects table
|
||||
table = self.table(self.queryset, user=request.user)
|
||||
if 'pk' in table.base_columns and (permissions['change'] or permissions['delete']):
|
||||
table.columns.show('pk')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user