Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ordering of VDC by device gives error "Cannot resolve keyword '_name' into field" #17337

Closed
dmulyalin opened this issue Sep 3, 2024 · 2 comments · Fixed by #17340
Closed
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@dmulyalin
Copy link

dmulyalin commented Sep 3, 2024

Deployment Type

Self-hosted

NetBox Version

v4.0.10

Python Version

3.10

Steps to Reproduce

  1. Got to DCIM -> Virtual Device Contexts
  2. Hit configure table and move "Device" to the right
  3. Sort table by device column - it throws error
  4. Now try going to any device view - throws same error as well

Expected Behavior

Can filter VDC by device

Observed Behavior

Getting this error in the WEB UI:

And this traceback on the cli:

netbox-1               | 10.0.2.2 - - [03/Sep/2024:07:43:29 +0000] "GET /ipam/services/?embedded=True&device_id=7736&return_url=%2Fdcim%2Fdevices%2F7736%2F HTTP/1.1" 200 2949 "http://127.0.0.1:8000/dcim/devices/7736/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
netbox-1               | ::1 - - [03/Sep/2024:07:43:34 +0000] "GET /login/ HTTP/1.1" 200 16656 "-" "curl/8.2.1"
netbox-1               | Internal Server Error: /dcim/virtual-device-contexts/
netbox-1               | Traceback (most recent call last):
netbox-1               |   File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
netbox-1               |     response = get_response(request)
netbox-1               |                ^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
netbox-1               |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
netbox-1               |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
netbox-1               |     return self.dispatch(request, *args, **kwargs)
netbox-1               |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/netbox/netbox/views/generic/base.py", line 77, in dispatch
netbox-1               |     return super().dispatch(request, *args, **kwargs)
netbox-1               |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/netbox/utilities/views.py", line 113, in dispatch
netbox-1               |     return super().dispatch(request, *args, **kwargs)
netbox-1               |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch
netbox-1               |     return handler(request, *args, **kwargs)
netbox-1               |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/netbox/netbox/views/generic/bulk_views.py", line 171, in get
netbox-1               |     table = self.get_table(self.queryset, request, has_bulk_actions)
netbox-1               |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/netbox/netbox/views/generic/mixins.py", line 53, in get_table
netbox-1               |     table.configure(request)
netbox-1               |   File "/opt/netbox/netbox/netbox/tables/tables.py", line 165, in configure
netbox-1               |     self.order_by = ordering
netbox-1               |     ^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.11/site-packages/django_tables2/tables.py", line 542, in order_by
netbox-1               |     self.data.order_by(self._order_by)
netbox-1               |   File "/opt/netbox/venv/lib/python3.11/site-packages/django_tables2/data.py", line 224, in order_by
netbox-1               |     self.data = self.data.order_by(*order_by_accessors)
netbox-1               |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/query.py", line 1701, in order_by
netbox-1               |     obj.query.add_ordering(*field_names)
netbox-1               |   File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/sql/query.py", line 2253, in add_ordering
netbox-1               |     self.names_to_path(item.split(LOOKUP_SEP), self.model._meta)
netbox-1               |   File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/sql/query.py", line 1772, in names_to_path
netbox-1               |     raise FieldError(
netbox-1               | django.core.exceptions.FieldError: Cannot resolve keyword '_name' into field. Choices are: bookmarks, comments, created, custom_field_data, description, device, device_id, id, identifier, interface_count, interfaces, journal_entries, last_updated, name, primary_ip4, primary_ip4_id, primary_ip6, primary_ip6_id, status, tagged_items, tags, tenant, tenant_id
@dmulyalin dmulyalin added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels Sep 3, 2024
@dmulyalin
Copy link
Author

As a work around have to type in the WEB UI:

http://127.0.0.1:8000/dcim/virtual-device-contexts/?sort=name

to revert the sorting, after this error goes away

@jeremystretch jeremystretch closed this as not planned Won't fix, can't repro, duplicate, stale Sep 3, 2024
@jeremystretch jeremystretch removed the status: needs triage This issue is awaiting triage by a maintainer label Sep 3, 2024
@jeremystretch jeremystretch reopened this Sep 3, 2024
@jeremystretch jeremystretch self-assigned this Sep 3, 2024
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation severity: low Does not significantly disrupt application functionality, or a workaround is available labels Sep 3, 2024
@dmulyalin
Copy link
Author

awesome, thank you for fixing this in so prompt manner @jeremystretch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants