available_on_device added to API Call multiple times #5287

Closed
opened 2025-12-29 19:26:14 +01:00 by adam · 2 comments
Owner

Originally created by @beatjoerg on GitHub (Sep 1, 2021).

Originally assigned to: @thatmattlove on GitHub.

NetBox version

v3.0.0

Python version

3.9

Steps to Reproduce

  1. Edit an Interface on a device
  2. Look at the API-Call: /api/ipam/vlans/?available_on_device=3&brief=true
  3. Cancel edit
  4. Edit an Interface on a device again
  5. Look at the API-Call: /api/ipam/vlans/?available_on_device=3&available_on_device=3&brief=true
  6. Repeat step 3 to 5 multiple times. Every time available_on_device is added again. Seems to be cached in code and not reset on every request.

Expected Behavior

Parameter "available_on_device" only appears once
/api/ipam/vlans/?available_on_device=3&brief=true

Observed Behavior

If the steps are repeated many times the URL of the API call gets too long.

Originally created by @beatjoerg on GitHub (Sep 1, 2021). Originally assigned to: @thatmattlove on GitHub. ### NetBox version v3.0.0 ### Python version 3.9 ### Steps to Reproduce 1. Edit an Interface on a device 2. Look at the API-Call: /api/ipam/vlans/?available_on_device=3&brief=true 3. Cancel edit 4. Edit an Interface on a device again 5. Look at the API-Call: /api/ipam/vlans/?available_on_device=3&available_on_device=3&brief=true 6. Repeat step 3 to 5 multiple times. Every time available_on_device is added again. Seems to be cached in code and not reset on every request. ### Expected Behavior Parameter "available_on_device" only appears once /api/ipam/vlans/?available_on_device=3&brief=true ### Observed Behavior If the steps are repeated many times the URL of the API call gets too long.
adam added the type: bugstatus: accepted labels 2025-12-29 19:26:14 +01:00
adam closed this issue 2025-12-29 19:26:15 +01:00
Author
Owner

@beatjoerg commented on GitHub (Sep 1, 2021):

Issue seems to related to this code line:
https://github.com/netbox-community/netbox/blob/develop/netbox/utilities/forms/widgets.py#L197
@thatmattlove

@beatjoerg commented on GitHub (Sep 1, 2021): Issue seems to related to this code line: https://github.com/netbox-community/netbox/blob/develop/netbox/utilities/forms/widgets.py#L197 @thatmattlove
Author
Owner

@beatjoerg commented on GitHub (Sep 1, 2021):

Fix do not resolve the issue completely..
If I edit after restart lets say device with id=3 then /api/ipam/vlans/?available_on_device=3&brief=true is constructed
If I edit then device id=1 the API call is still /api/ipam/vlans/?available_on_device=3&brief=true (I expect available_on_device=1), only a restart of django resolves the issue.

Why is
current = self.static_params[key]
self.static_params[key] = [v for v in set([*current, value])]
required?
It seems that it is not per GET request, it remains for the full time of the codebase is running.

@beatjoerg commented on GitHub (Sep 1, 2021): Fix do not resolve the issue completely.. If I edit after restart lets say device with id=3 then /api/ipam/vlans/?available_on_device=3&brief=true is constructed If I edit then device id=1 the API call is still /api/ipam/vlans/?available_on_device=3&brief=true (I expect available_on_device=1), only a restart of django resolves the issue. Why is `current = self.static_params[key]` `self.static_params[key] = [v for v in set([*current, value])]` required? It seems that it is not per GET request, it remains for the full time of the codebase is running.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5287