Cannot sort Devices by device NAME #10863

Closed
opened 2025-12-29 21:36:53 +01:00 by adam · 6 comments
Owner

Originally created by @bobbwest on GitHub (Mar 8, 2025).

Originally assigned to: @jnovinger on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.2.5

Python Version

3.12

Steps to Reproduce

On any netbox with one or more devices:

  1. Go to DEVICES > Devices
  2. Click the "NAME" column heading to sort by that field.

Expected Behavior

Devices to be sorted by name.

Observed Behavior

Nothing. Devices are not sorted by name.

This also happens on the Demo NetBox:

https://demo.netbox.dev/dcim/devices/?sort=name

In this case, when the sort field is specified on the command line, you get:

Server Error
There was a problem with your request. Please contact an administrator.

The complete exception is provided below:

<class 'django.core.exceptions.FieldError'>

Cannot resolve keyword 'label' into field. Choices are: airflow, asset_tag, bookmarks, cabletermination, cluster, cluster_id, comments, config_template, config_template_id, console_port_count, console_server_port_count, consoleports, consoleserverports, contacts, created, custom_field_data, description, device_bay_count, device_type, device_type_id, devicebays, face, front_port_count, frontports, id, images, interface_count, interfaces, inventory_item_count, inventoryitems, journal_entries, last_updated, latitude, local_context_data, location, location_id, longitude, module_bay_count, modulebays, modules, name, oob_ip, oob_ip_id, parent_bay, platform, platform_id, position, power_outlet_count, power_port_count, poweroutlets, powerports, primary_ip4, primary_ip4_id, primary_ip6, primary_ip6_id, rack, rack_id, rear_port_count, rearports, role, role_id, serial, services, site, site_id, status, subscriptions, tagged_items, tags, tenant, tenant_id, vc_master_for, vc_position, vc_priority, vdcs, virtual_chassis, virtual_chassis_id, virtual_machines

Python version: 3.12.9
NetBox version: 4.2.4
Plugins: 
  netbox_demo: 0.5.0
Originally created by @bobbwest on GitHub (Mar 8, 2025). Originally assigned to: @jnovinger on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.2.5 ### Python Version 3.12 ### Steps to Reproduce On any netbox with one or more devices: 1. Go to DEVICES > Devices 2. Click the "NAME" column heading to sort by that field. ### Expected Behavior Devices to be sorted by name. ### Observed Behavior Nothing. Devices are not sorted by name. This also happens on the Demo NetBox: https://demo.netbox.dev/dcim/devices/?sort=name In this case, when the sort field is specified on the command line, you get: ``` Server Error There was a problem with your request. Please contact an administrator. The complete exception is provided below: <class 'django.core.exceptions.FieldError'> Cannot resolve keyword 'label' into field. Choices are: airflow, asset_tag, bookmarks, cabletermination, cluster, cluster_id, comments, config_template, config_template_id, console_port_count, console_server_port_count, consoleports, consoleserverports, contacts, created, custom_field_data, description, device_bay_count, device_type, device_type_id, devicebays, face, front_port_count, frontports, id, images, interface_count, interfaces, inventory_item_count, inventoryitems, journal_entries, last_updated, latitude, local_context_data, location, location_id, longitude, module_bay_count, modulebays, modules, name, oob_ip, oob_ip_id, parent_bay, platform, platform_id, position, power_outlet_count, power_port_count, poweroutlets, powerports, primary_ip4, primary_ip4_id, primary_ip6, primary_ip6_id, rack, rack_id, rear_port_count, rearports, role, role_id, serial, services, site, site_id, status, subscriptions, tagged_items, tags, tenant, tenant_id, vc_master_for, vc_position, vc_priority, vdcs, virtual_chassis, virtual_chassis_id, virtual_machines Python version: 3.12.9 NetBox version: 4.2.4 Plugins: netbox_demo: 0.5.0 ```
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:36:53 +01:00
adam closed this issue 2025-12-29 21:36:53 +01:00
Author
Owner

@renatoalmeidaoliveira commented on GitHub (Mar 8, 2025):

Confirmed this issue, it was also reported in https://github.com/netbox-community/netbox/discussions/18809

@renatoalmeidaoliveira commented on GitHub (Mar 8, 2025): Confirmed this issue, it was also reported in https://github.com/netbox-community/netbox/discussions/18809
Author
Owner

@bobbwest commented on GitHub (Mar 9, 2025):

Ah, thanks for pointing out the previous report for this issue. I thought it was new for 4.2.5, I didn't realise it existed in 4.2.4 also.

@bobbwest commented on GitHub (Mar 9, 2025): Ah, thanks for pointing out the previous report for this issue. I thought it was new for 4.2.5, I didn't realise it existed in 4.2.4 also.
Author
Owner

@VitMain commented on GitHub (Mar 9, 2025):

It does not fix the bug but can be a temporary solution.
Open /user/preferences/ then Clear table preferences for the DeviceTable.

@VitMain commented on GitHub (Mar 9, 2025): It does not fix the bug but can be a temporary solution. Open /user/preferences/ then Clear table preferences for the DeviceTable.
Author
Owner

@maciejopalinski commented on GitHub (Mar 17, 2025):

It does not fix the bug but can be a temporary solution. Open /user/preferences/ then Clear table preferences for the DeviceTable.

This works.
Is there a way to clear table preferences for all users? Maybe an SQL query?

@maciejopalinski commented on GitHub (Mar 17, 2025): > It does not fix the bug but can be a temporary solution. Open /user/preferences/ then Clear table preferences for the DeviceTable. This works. Is there a way to clear table preferences for all users? Maybe an SQL query?
Author
Owner

@maciejopalinski commented on GitHub (Mar 17, 2025):

It does not fix the bug but can be a temporary solution. Open /user/preferences/ then Clear table preferences for the DeviceTable.

This works. Is there a way to clear table preferences for all users? Maybe an SQL query?

UPDATE public.users_userconfig SET "data"='{}'::jsonb;

this seems to work

@maciejopalinski commented on GitHub (Mar 17, 2025): > > It does not fix the bug but can be a temporary solution. Open /user/preferences/ then Clear table preferences for the DeviceTable. > > This works. Is there a way to clear table preferences for all users? Maybe an SQL query? ```sql UPDATE public.users_userconfig SET "data"='{}'::jsonb; ``` this seems to work
Author
Owner

@RakeshAMD commented on GitHub (Apr 16, 2025):

It does not fix the bug but can be a temporary solution. Open /user/preferences/ then Clear table preferences for the DeviceTable.

this worked.

@RakeshAMD commented on GitHub (Apr 16, 2025): > It does not fix the bug but can be a temporary solution. Open /user/preferences/ then Clear table preferences for the DeviceTable. this worked.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10863