Server error when trying to sort services list by parent #3690

Closed
opened 2025-12-29 18:30:38 +01:00 by adam · 0 comments
Owner

Originally created by @hoalex on GitHub (May 14, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.6.8
  • NetBox version: 2.8.4

Steps to Reproduce

  1. Disable any installed plugins by commenting out the PLUGINS setting in
    configuration.py.
  2. Navigate to IPAM -> Services
  3. Click on the column header Parent

Expected Behavior

The service list is sorted by parent.

Observed Behavior

The following server error appears:
grafik

Trace:


Traceback (most recent call last):
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/contrib/auth/mixins.py", line 85, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/views/generic/base.py", line 97, in dispatch
    return handler(request, *args, **kwargs)
  File "/opt/netbox/netbox/utilities/views.py", line 182, in get
    RequestConfig(request, paginate).configure(table)
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django_tables2/config.py", line 61, in configure
    table.paginate(**kwargs)
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django_tables2/tables.py", line 584, in paginate
    self.page = self.paginator.page(page)
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/core/paginator.py", line 70, in page
    number = self.validate_number(number)
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/core/paginator.py", line 48, in validate_number
    if number > self.num_pages:
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/core/paginator.py", line 97, in num_pages
    if self.count == 0 and not self.allow_empty_first_page:
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/core/paginator.py", line 92, in count
    return len(self.object_list)
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django_tables2/rows.py", line 330, in __len__
    length = len(self.data)
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django_tables2/data.py", line 153, in __len__
    self._length = self.data.count()
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/cacheops/query.py", line 331, in count
    return cached_as(self)(lambda: self._no_monkey.count(self))()
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/cacheops/query.py", line 95, in cached_as
    key_extra = [qs._cache_key(prefix=False) for qs in querysets]
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/cacheops/query.py", line 95, in <listcomp>
    key_extra = [qs._cache_key(prefix=False) for qs in querysets]
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/cacheops/query.py", line 175, in _cache_key
    sql, params = self.query.get_compiler(self.db).as_sql()
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 490, in as_sql
    extra_select, order_by, group_by = self.pre_sql_setup()
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 52, in pre_sql_setup
    order_by = self.get_order_by()
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 342, in get_order_by
    field, self.query.get_meta(), default_order=asc))
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 720, in find_ordering_name
    field, targets, alias, joins, path, opts, transform_function = self._setup_joins(pieces, opts, alias)
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 755, in _setup_joins
    field, targets, opts, joins, path, transform_function = self.query.setup_joins(pieces, opts, alias)
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/db/models/sql/query.py", line 1568, in setup_joins
    names[:pivot], opts, allow_many, fail_on_missing=True,
  File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/db/models/sql/query.py", line 1484, in names_to_path
    "Choices are: %s" % (name, ", ".join(available)))

Exception Type: FieldError at /ipam/services/
Exception Value: Cannot resolve keyword 'parent' into field. Choices are: created, custom_field_values, description, device, device_id, id, ipaddresses, last_updated, name, port, protocol, tagged_items, tags, virtual_machine, virtual_machine_id
Originally created by @hoalex on GitHub (May 14, 2020). Originally assigned to: @jeremystretch on GitHub. <!-- 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.6.8 * NetBox version: 2.8.4 <!-- 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 1. Disable any installed plugins by commenting out the `PLUGINS` setting in `configuration.py`. 2. Navigate to `IPAM` -> `Services` 3. Click on the column header `Parent` <!-- What did you expect to happen? --> ### Expected Behavior The service list is sorted by parent. <!-- What happened instead? --> ### Observed Behavior The following server error appears: ![grafik](https://user-images.githubusercontent.com/6103894/81932607-58089780-95ec-11ea-9c0c-54e2f8c3ee15.png) Trace: ``` Traceback (most recent call last): File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/views/generic/base.py", line 71, in view return self.dispatch(request, *args, **kwargs) File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/contrib/auth/mixins.py", line 85, in dispatch return super().dispatch(request, *args, **kwargs) File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/views/generic/base.py", line 97, in dispatch return handler(request, *args, **kwargs) File "/opt/netbox/netbox/utilities/views.py", line 182, in get RequestConfig(request, paginate).configure(table) File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django_tables2/config.py", line 61, in configure table.paginate(**kwargs) File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django_tables2/tables.py", line 584, in paginate self.page = self.paginator.page(page) File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/core/paginator.py", line 70, in page number = self.validate_number(number) File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/core/paginator.py", line 48, in validate_number if number > self.num_pages: File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/utils/functional.py", line 48, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/core/paginator.py", line 97, in num_pages if self.count == 0 and not self.allow_empty_first_page: File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/utils/functional.py", line 48, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/core/paginator.py", line 92, in count return len(self.object_list) File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django_tables2/rows.py", line 330, in __len__ length = len(self.data) File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django_tables2/data.py", line 153, in __len__ self._length = self.data.count() File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/cacheops/query.py", line 331, in count return cached_as(self)(lambda: self._no_monkey.count(self))() File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/cacheops/query.py", line 95, in cached_as key_extra = [qs._cache_key(prefix=False) for qs in querysets] File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/cacheops/query.py", line 95, in <listcomp> key_extra = [qs._cache_key(prefix=False) for qs in querysets] File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/cacheops/query.py", line 175, in _cache_key sql, params = self.query.get_compiler(self.db).as_sql() File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 490, in as_sql extra_select, order_by, group_by = self.pre_sql_setup() File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 52, in pre_sql_setup order_by = self.get_order_by() File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 342, in get_order_by field, self.query.get_meta(), default_order=asc)) File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 720, in find_ordering_name field, targets, alias, joins, path, opts, transform_function = self._setup_joins(pieces, opts, alias) File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 755, in _setup_joins field, targets, opts, joins, path, transform_function = self.query.setup_joins(pieces, opts, alias) File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/db/models/sql/query.py", line 1568, in setup_joins names[:pivot], opts, allow_many, fail_on_missing=True, File "/opt/netbox-2.8.4/venv/lib64/python3.6/site-packages/django/db/models/sql/query.py", line 1484, in names_to_path "Choices are: %s" % (name, ", ".join(available))) Exception Type: FieldError at /ipam/services/ Exception Value: Cannot resolve keyword 'parent' into field. Choices are: created, custom_field_values, description, device, device_id, id, ipaddresses, last_updated, name, port, protocol, tagged_items, tags, virtual_machine, virtual_machine_id ```
adam added the type: bugstatus: accepted labels 2025-12-29 18:30:38 +01:00
adam closed this issue 2025-12-29 18:30:38 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3690