ConfigContext optimization from #4559 not active for REST API views #4372

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

Originally created by @jeremystretch on GitHub (Dec 17, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.6.9
  • NetBox version: 2.10.1

Steps to Reproduce

  1. With debug enabled, make a REST API call for /api/dcim/devices/ and inspect the SQL queries being made.

Expected Behavior

Retrieval of ConfigContext data should be optimized per #4559.

Observed Behavior

ConfigContextQuerySetMixin's get_queryset() method is not called because DeviceViewSet inherits first from CustomFieldModelViewSet, which already provides get_queryset() (from the base ViewSet class).

Reversing the order of these parent classes ensures that the optimization provided by ConfigContextQuerySetMixin takes effect.

Originally created by @jeremystretch on GitHub (Dec 17, 2020). Originally assigned to: @jeremystretch on GitHub. ### Environment * Python version: 3.6.9 * NetBox version: 2.10.1 ### Steps to Reproduce 1. With debug enabled, make a REST API call for `/api/dcim/devices/` and inspect the SQL queries being made. ### Expected Behavior Retrieval of ConfigContext data should be optimized per #4559. ### Observed Behavior ConfigContextQuerySetMixin's `get_queryset()` method is not called because DeviceViewSet inherits first from CustomFieldModelViewSet, which already provides `get_queryset()` (from the base ViewSet class). Reversing the order of these parent classes ensures that the optimization provided by ConfigContextQuerySetMixin takes effect.
adam added the type: bugstatus: accepted labels 2025-12-29 18:35:22 +01:00
adam closed this issue 2025-12-29 18:35:22 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4372