Skip to content

Commit

Permalink
Simplify Anon user logic
Browse files Browse the repository at this point in the history
  • Loading branch information
renatoalmeidaoliveira committed Jan 31, 2025
1 parent 62148bb commit f5bdf7b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions netbox/netbox/tables/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,7 @@ def __init__(self, *args, user=None, **kwargs):
if user is not None and not isinstance(user, AnonymousUser):
selected_columns = user.config.get(f"tables.{self.name}.columns")
elif isinstance(user, AnonymousUser) and hasattr(settings, 'DEFAULT_USER_PREFERENCES'):
default_user_preferences = settings.DEFAULT_USER_PREFERENCES
default_table = default_user_preferences.get('tables', {}).get(self.name, {}).get('columns', {})
if default_table != {}:
selected_columns = default_table
selected_columns = settings.DEFAULT_USER_PREFERENCES.get('tables', {}).get(self.name, {}).get('columns')
if not selected_columns:
selected_columns = getattr(self.Meta, 'default_columns', self.Meta.fields)

Expand Down

0 comments on commit f5bdf7b

Please sign in to comment.