-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closes #18843: use color name in cable export #19983
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
Closes #18843: use color name in cable export #19983
Conversation
arthanson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you add Color Name to the cable list and then sort on the color name you will get an exception.
Traceback (most recent call last):
File "/Users/ahanson/dev/work/netbox/venv/lib/python3.13/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/Users/ahanson/dev/work/netbox/venv/lib/python3.13/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/ahanson/dev/work/netbox/venv/lib/python3.13/site-packages/django/views/generic/base.py", line 104, in view
return self.dispatch(request, *args, **kwargs)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ahanson/dev/work/netbox/netbox/netbox/views/generic/base.py", line 77, in dispatch
return super().dispatch(request, *args, **kwargs)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ahanson/dev/work/netbox/netbox/utilities/views.py", line 125, in dispatch
return super().dispatch(request, *args, **kwargs)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ahanson/dev/work/netbox/netbox/utilities/views.py", line 39, in dispatch
return super().dispatch(request, *args, **kwargs)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ahanson/dev/work/netbox/venv/lib/python3.13/site-packages/django/views/generic/base.py", line 143, in dispatch
return handler(request, *args, **kwargs)
File "/Users/ahanson/dev/work/netbox/netbox/netbox/views/generic/bulk_views.py", line 181, in get
table = self.get_table(self.queryset, request, has_bulk_actions)
File "/Users/ahanson/dev/work/netbox/netbox/netbox/views/generic/mixins.py", line 65, in get_table
table.configure(request)
~~~~~~~~~~~~~~~^^^^^^^^^
File "/Users/ahanson/dev/work/netbox/netbox/netbox/tables/tables.py", line 180, in configure
self.order_by = ordering
^^^^^^^^^^^^^
File "/Users/ahanson/dev/work/netbox/venv/lib/python3.13/site-packages/django_tables2/tables.py", line 542, in order_by
self.data.order_by(self._order_by)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
File "/Users/ahanson/dev/work/netbox/venv/lib/python3.13/site-packages/django_tables2/data.py", line 224, in order_by
self.data = self.data.order_by(*order_by_accessors)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/Users/ahanson/dev/work/netbox/venv/lib/python3.13/site-packages/django/db/models/query.py", line 1722, in order_by
obj.query.add_ordering(*field_names)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "/Users/ahanson/dev/work/netbox/venv/lib/python3.13/site-packages/django/db/models/sql/query.py", line 2291, in add_ordering
self.names_to_path(item.split(LOOKUP_SEP), self.model._meta)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ahanson/dev/work/netbox/venv/lib/python3.13/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
raise FieldError(
...<2 lines>...
)
django.core.exceptions.FieldError: Cannot resolve keyword 'color_name' into field. Choices are: _abs_length, bookmarks, color, comments, created, custom_field_data, description, id, journal_entries, label, last_updated, length, length_unit, status, subscriptions, tagged_items, tags, tenant, tenant_id, terminations, type
|
Pardon the oversight. I've now disabled sorting, since the plan of the implementation wasn't to represent the full feature set of a field in the first place. |
arthanson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Jathn !
Closes #18843: using color name in cable export
The changes made allow for the name of the color to be exported when exporting cables. This applies to both full table export "All data (csv)" and using custom export templates.
Changes made: