Bulk edit with select all matching query raises exception #3381

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

Originally created by @hSaria on GitHub (Feb 22, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.6.8
  • NetBox version: 2.7.7

Steps to Reproduce

  1. Go a page with multiple pages, like /ipam/ip-addresses/?per_page=5
  2. Check the select all button which will then display select all matching query section
  3. Check the Select all x IP addresses matching query and click on edit selected button in that section

This is similar to #4175

Expected Behavior

The bulk edit page is loaded

Observed Behavior

Exception

<class 'TypeError'>

int() argument must be a string, a bytes-like object or a number, not 'list'

Traceback

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/contrib/auth/mixins.py", line 85, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/views/generic/base.py", line 97, in dispatch
    return handler(request, *args, **kwargs)
  File "/opt/netbox-dev/netbox/utilities/views.py", line 723, in post
    table = self.table(self.queryset.filter(pk__in=post_data.getlist('pk')), orderable=False)
  File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 892, in filter
    return self._filter_or_exclude(False, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 910, in _filter_or_exclude
    clone.query.add_q(Q(*args, **kwargs))
  File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/query.py", line 1290, in add_q
    clause, _ = self._add_q(q_object, self.used_aliases)
  File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/query.py", line 1318, in _add_q
    split_subq=split_subq, simple_col=simple_col,
  File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/query.py", line 1251, in build_filter
    condition = self.build_lookup(lookups, col, value)
  File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/query.py", line 1116, in build_lookup
    lookup = lookup_class(lhs, rhs)
  File "/usr/local/lib/python3.6/site-packages/django/db/models/lookups.py", line 20, in __init__
    self.rhs = self.get_prep_lookup()
  File "/usr/local/lib/python3.6/site-packages/django/db/models/lookups.py", line 210, in get_prep_lookup
    rhs_value = self.lhs.output_field.get_prep_value(rhs_value)
  File "/usr/local/lib/python3.6/site-packages/django/db/models/fields/__init__.py", line 972, in get_prep_value
    return int(value)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'
Originally created by @hSaria on GitHub (Feb 22, 2020). Originally assigned to: @jeremystretch on GitHub. ### Environment * Python version: 3.6.8 * NetBox version: 2.7.7 ### Steps to Reproduce 1. Go a page with multiple pages, like `/ipam/ip-addresses/?per_page=5` 2. Check the select all button which will then display `select all matching query` section 3. Check the `Select all x IP addresses matching query ` and click on `edit selected` button in that section This is similar to #4175 ### Expected Behavior The bulk edit page is loaded ### Observed Behavior Exception ``` <class 'TypeError'> int() argument must be a string, a bytes-like object or a number, not 'list' ``` Traceback ``` Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python3.6/site-packages/django/views/generic/base.py", line 71, in view return self.dispatch(request, *args, **kwargs) File "/usr/local/lib/python3.6/site-packages/django/contrib/auth/mixins.py", line 85, in dispatch return super().dispatch(request, *args, **kwargs) File "/usr/local/lib/python3.6/site-packages/django/views/generic/base.py", line 97, in dispatch return handler(request, *args, **kwargs) File "/opt/netbox-dev/netbox/utilities/views.py", line 723, in post table = self.table(self.queryset.filter(pk__in=post_data.getlist('pk')), orderable=False) File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 892, in filter return self._filter_or_exclude(False, *args, **kwargs) File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 910, in _filter_or_exclude clone.query.add_q(Q(*args, **kwargs)) File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/query.py", line 1290, in add_q clause, _ = self._add_q(q_object, self.used_aliases) File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/query.py", line 1318, in _add_q split_subq=split_subq, simple_col=simple_col, File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/query.py", line 1251, in build_filter condition = self.build_lookup(lookups, col, value) File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/query.py", line 1116, in build_lookup lookup = lookup_class(lhs, rhs) File "/usr/local/lib/python3.6/site-packages/django/db/models/lookups.py", line 20, in __init__ self.rhs = self.get_prep_lookup() File "/usr/local/lib/python3.6/site-packages/django/db/models/lookups.py", line 210, in get_prep_lookup rhs_value = self.lhs.output_field.get_prep_value(rhs_value) File "/usr/local/lib/python3.6/site-packages/django/db/models/fields/__init__.py", line 972, in get_prep_value return int(value) TypeError: int() argument must be a string, a bytes-like object or a number, not 'list' ```
adam added the type: bugstatus: accepted labels 2025-12-29 18:28:35 +01:00
adam closed this issue 2025-12-29 18:28:36 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3381