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

Cannot resolve keyword 'prefix_flat' into field. #10040

Closed
lizard626 opened this issue Aug 16, 2022 · 5 comments
Closed

Cannot resolve keyword 'prefix_flat' into field. #10040

lizard626 opened this issue Aug 16, 2022 · 5 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@lizard626
Copy link

NetBox version

v3.2.8

Python version

3.10

Steps to Reproduce

  1. Added new ipam | prefix entry:
    vrf: null
    role: null
    site: null
    tags: []
    vlan: null
    prefix: "10.183.0.0/16"
    status: "active"
    tenant: null
    created: "2022-08-16T17:47:13.439Z"
    is_pool: false
    description: "MP LA Lumen - Live Audio Subnet"
    last_updated: "2022-08-16T17:47:13.439Z"
    custom_fields: {}
    mark_utilized: false

Expected Behavior

/ipam/prefixes/ expected to rendor.

Observed Behavior

Server Error page displayed:

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 'prefix_flat' into field. Choices are: _children, _depth, created, custom_field_data, description, id, is_pool, journal_entries, last_updated, mark_utilized, prefix, role, role_id, site, site_id, status, tagged_items, tags, tenant, tenant_id, vlan, vlan_id, vrf, vrf_id

Python version: 3.10.4
NetBox version: 3.2.8

@lizard626 lizard626 added the type: bug A confirmed report of unexpected behavior in the application label Aug 16, 2022
@lizard626
Copy link
Author

Full traceback from console:

2022/08/16 21:34:46 [info] 30#30 "netbox" application started
Internal Server Error: /ipam/prefixes/
Traceback (most recent call last):
File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/netbox/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 84, in view
return self.dispatch(request, *args, **kwargs)
File "/opt/netbox/netbox/utilities/views.py", line 90, in dispatch
return super().dispatch(request, *args, **kwargs)
File "/opt/netbox/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 119, in dispatch
return handler(request, *args, **kwargs)
File "/opt/netbox/netbox/netbox/views/generic/bulk_views.py", line 186, in get
table.configure(request)
File "/opt/netbox/netbox/netbox/tables/tables.py", line 142, in configure
self.order_by = ordering
File "/opt/netbox/venv/lib/python3.10/site-packages/django_tables2/tables.py", line 543, in order_by
self.data.order_by(self._order_by)
File "/opt/netbox/venv/lib/python3.10/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.10/site-packages/django/db/models/query.py", line 1295, in order_by
obj.query.add_ordering(*field_names)
File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/sql/query.py", line 2167, in add_ordering
self.names_to_path(item.split(LOOKUP_SEP), self.model._meta)
File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/sql/query.py", line 1677, in names_to_path
raise FieldError(
django.core.exceptions.FieldError: Cannot resolve keyword 'prefix_flat' into field. Choices are: _children, _depth, created, custom_field_data, description, id, is_pool, journal_entries, last_updated, mark_utilized, prefix, role, role_id, site, site_id, status, tagged_items, tags, tenant, tenant_id, vlan, vlan_id, vrf, vrf_id
172.29.0.1 - - [16/Aug/2022:21:34:46 +0000] "GET /ipam/prefixes/ HTTP/1.1" 500 1871 "https://netbox.publicradio.org/ipam/ip-addresses/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"

@jeremystretch
Copy link
Member

Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v3.2.9. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data.

@jeremystretch jeremystretch added the status: revisions needed This issue requires additional information to be actionable label Aug 17, 2022
@jeremystretch
Copy link
Member

I suspect I know what happened: You added the "Prefix (flat)" column to the prefixes table, and then attempted to sort by it. This won't appear to cause any immediate effect, because the table rendering via HTMX simply doesn't update the results. However, when you navigate back to the prefixes list, it attempts to render the table ordering by the (non-existent) prefix_flat column.

As a workaround, you can navigate to /ipam/prefixes/?sort=prefix to clear the problematic ordering.

@jeremystretch jeremystretch added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation and removed status: revisions needed This issue requires additional information to be actionable labels Aug 17, 2022
@lizard626
Copy link
Author

Hi Jeremy, that was exactly the issue, and your workaround solved the issue. Thanks!

@lizard626
Copy link
Author

Update: Was able to reproduce the issue in 3.2.8 by re-adding the Prefix (flat) column. But in 3.2.9, I can no longer reproduce the issue.

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Aug 18, 2022
@jeremystretch jeremystretch self-assigned this Aug 18, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

2 participants