BaseTable should not clear existing prefetched data from QuerySet #6426

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

Originally created by @jeremystretch on GitHub (Apr 29, 2022).

Originally assigned to: @jeremystretch on GitHub.

Proposed Changes

Remove the automatic clearing of pre-prefetched QuerySet data (i.e. prefetch_related(None)) from BaseTable initialization. This will ensure that any prefetched data already applied to the QuerySet is retained.

Justification

Under some circumstances, it may be desirable to prefetch additional data that is not automatically detected by the table. There is no real benefit to prohibiting this.

Originally created by @jeremystretch on GitHub (Apr 29, 2022). Originally assigned to: @jeremystretch on GitHub. ### Proposed Changes Remove the automatic clearing of pre-prefetched QuerySet data (i.e. `prefetch_related(None)`) from BaseTable initialization. This will ensure that any prefetched data already applied to the QuerySet is retained. ### Justification Under some circumstances, it may be desirable to prefetch additional data that is not automatically detected by the table. There is no real benefit to prohibiting this.
adam added the status: acceptedtype: housekeeping labels 2025-12-29 19:40:35 +01:00
adam closed this issue 2025-12-29 19:40:35 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6426