BaseTable strips prefetching for GenericForeignKeys erroneously #4168

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

Originally created by @jeremystretch on GitHub (Oct 7, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.6.9
  • NetBox version: 2.9.4

Steps to Reproduce

  1. Enable debugging
  2. View the cables list
  3. Inspect SQL queries

Expected Behavior

CableListView prefetches the A and B side terminations for each Cable instance, so no additional SQL queries should be executed for this data.

Observed Behavior

The A and B terminations are queried individually for each cable in the list. As this is due to a bug in BaseTable, many views within NetBox are affected.

Originally created by @jeremystretch on GitHub (Oct 7, 2020). Originally assigned to: @jeremystretch on GitHub. ### Environment * Python version: 3.6.9 * NetBox version: 2.9.4 ### Steps to Reproduce 1. Enable debugging 2. View the cables list 3. Inspect SQL queries ### Expected Behavior CableListView prefetches the A and B side terminations for each Cable instance, so no additional SQL queries should be executed for this data. ### Observed Behavior The A and B terminations are queried individually for each cable in the list. As this is due to a bug in BaseTable, many views within NetBox are affected.
adam added the type: bugstatus: accepted labels 2025-12-29 18:33:36 +01:00
adam closed this issue 2025-12-29 18:33: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#4168