Skip to content

Sorting IP address listing by Assigned causes exception #5085

@abrahamvegh

Description

@abrahamvegh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions