Sorting IP address listing by Assigned causes exception #4059

Closed
opened 2025-12-29 18:32:54 +01:00 by adam · 3 comments
Owner

Originally created by @abrahamvegh on GitHub (Sep 1, 2020).

Environment

  • Python version: 3.7.3
  • NetBox version: 2.9.2

Steps to Reproduce

Access /ipam/ip-addresses/?sort=assigned

Expected Behavior

Sorting works as expected.

Observed Behavior

Traceback (most recent call last):
 File "/opt/netbox/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
   response = get_response(request)
 File "/opt/netbox/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 179, in _get_response
   response = wrapped_callback(request, *callback_args, **callback_kwargs)
 File "/opt/netbox/venv/lib/python3.7/site-packages/django/views/generic/base.py", line 73, in view
   return self.dispatch(request, *args, **kwargs)
 File "/opt/netbox/netbox/utilities/views.py", line 123, in dispatch
   return super().dispatch(request, *args, **kwargs)
 File "/opt/netbox/venv/lib/python3.7/site-packages/django/views/generic/base.py", line 101, in dispatch
   return handler(request, *args, **kwargs)
 File "/opt/netbox/netbox/utilities/views.py", line 318, in get
   RequestConfig(request, paginate).configure(table)
 File "/opt/netbox/venv/lib/python3.7/site-packages/django_tables2/config.py", line 42, in configure
   table.order_by = order_by
 File "/opt/netbox/venv/lib/python3.7/site-packages/django_tables2/tables.py", line 543, in order_by
   self.data.order_by(self._order_by)
 File "/opt/netbox/venv/lib/python3.7/site-packages/django_tables2/data.py", line 226, in order_by
   self.data = self.data.order_by(*order_by_accessors)
 File "/opt/netbox/venv/lib/python3.7/site-packages/django/db/models/query.py", line 1134, in order_by
   obj.query.add_ordering(*field_names)
 File "/opt/netbox/venv/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1919, in add_ordering
   self.names_to_path(item.split(LOOKUP_SEP), self.model._meta)
 File "/opt/netbox/venv/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1482, in names_to_path
   "Choices are: %s" % (name, ", ".join(available)))

Exception Type: FieldError at /ipam/ip-addresses/
Exception Value: Cannot resolve keyword 'assigned' into field. Choices are: address, assigned_object, assigned_object_id, assigned_object_type, assigned_object_type_id, created, custom_field_values, description, dns_name, id, interface, last_updated, nat_inside, nat_inside_id, nat_outside, primary_ip4_for, primary_ip6_for, role, services, status, tagged_items, tags, tenant, tenant_id, vminterface, vrf, vrf_id
Originally created by @abrahamvegh on GitHub (Sep 1, 2020). <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report, and that any plugins have been disabled. --> ### Environment * Python version: 3.7.3 * NetBox version: 2.9.2 <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox. Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a client library such as pynetbox. --> ### Steps to Reproduce Access `/ipam/ip-addresses/?sort=assigned` <!-- What did you expect to happen? --> ### Expected Behavior Sorting works as expected. <!-- What happened instead? --> ### Observed Behavior ``` Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/opt/netbox/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 179, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/opt/netbox/venv/lib/python3.7/site-packages/django/views/generic/base.py", line 73, in view return self.dispatch(request, *args, **kwargs) File "/opt/netbox/netbox/utilities/views.py", line 123, in dispatch return super().dispatch(request, *args, **kwargs) File "/opt/netbox/venv/lib/python3.7/site-packages/django/views/generic/base.py", line 101, in dispatch return handler(request, *args, **kwargs) File "/opt/netbox/netbox/utilities/views.py", line 318, in get RequestConfig(request, paginate).configure(table) File "/opt/netbox/venv/lib/python3.7/site-packages/django_tables2/config.py", line 42, in configure table.order_by = order_by File "/opt/netbox/venv/lib/python3.7/site-packages/django_tables2/tables.py", line 543, in order_by self.data.order_by(self._order_by) File "/opt/netbox/venv/lib/python3.7/site-packages/django_tables2/data.py", line 226, in order_by self.data = self.data.order_by(*order_by_accessors) File "/opt/netbox/venv/lib/python3.7/site-packages/django/db/models/query.py", line 1134, in order_by obj.query.add_ordering(*field_names) File "/opt/netbox/venv/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1919, in add_ordering self.names_to_path(item.split(LOOKUP_SEP), self.model._meta) File "/opt/netbox/venv/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1482, in names_to_path "Choices are: %s" % (name, ", ".join(available))) Exception Type: FieldError at /ipam/ip-addresses/ Exception Value: Cannot resolve keyword 'assigned' into field. Choices are: address, assigned_object, assigned_object_id, assigned_object_type, assigned_object_type_id, created, custom_field_values, description, dns_name, id, interface, last_updated, nat_inside, nat_inside_id, nat_outside, primary_ip4_for, primary_ip6_for, role, services, status, tagged_items, tags, tenant, tenant_id, vminterface, vrf, vrf_id ```
adam added the type: bugstatus: accepted labels 2025-12-29 18:32:54 +01:00
adam closed this issue 2025-12-29 18:32:54 +01:00
Author
Owner

@DanSheps commented on GitHub (Sep 1, 2020):

Looks to be related to e8e4ff4111 (diff-2289a8514222a573b8ff1f0e89740a4c)

@DanSheps commented on GitHub (Sep 1, 2020): Looks to be related to https://github.com/netbox-community/netbox/commit/e8e4ff4111a23bb34cc10187d4f1a1963c406787#diff-2289a8514222a573b8ff1f0e89740a4c
Author
Owner

@jeremystretch commented on GitHub (Sep 1, 2020):

Access /ipam/ip-addresses/?sort=assigned

Where does this appear in the UI?

@jeremystretch commented on GitHub (Sep 1, 2020): > Access `/ipam/ip-addresses/?sort=assigned` Where does this appear in the UI?
Author
Owner

@abrahamvegh commented on GitHub (Sep 1, 2020):

Access /ipam/ip-addresses/?sort=assigned

Where does this appear in the UI?

  1. Click ‘IPAM’ > ‘IP Addresses’
  2. Click the ‘Assigned’ column header
@abrahamvegh commented on GitHub (Sep 1, 2020): > > Access `/ipam/ip-addresses/?sort=assigned` > > Where does this appear in the UI? 1. Click ‘IPAM’ > ‘IP Addresses’ 2. Click the ‘Assigned’ column header
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4059