Enable dynamic queryset resolution for generic views #7158

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

Originally created by @jeremystretch on GitHub (Oct 25, 2022).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.3.5

Feature type

New functionality

Proposed functionality

Add a get_queryset() method to the base generic views to support dynamic resolution of a view's queryset. This method will accept a request parameter to enable responding to different request conditions and parameters, similar to Django's own generic views.

This method will be called by all views to determine the queryset. To maintain backward compatibility, this method will by default simply return the queryset class attribute.

Use case

This change enables the execution of custom logic based on the incoming request when determining the starting queryset for a review.

Database changes

No response

External dependencies

No response

Originally created by @jeremystretch on GitHub (Oct 25, 2022). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.3.5 ### Feature type New functionality ### Proposed functionality Add a `get_queryset()` method to the base [generic views](https://docs.netbox.dev/en/stable/plugins/development/views/) to support dynamic resolution of a view's queryset. This method will accept a `request` parameter to enable responding to different request conditions and parameters, similar to Django's own [generic views](https://docs.djangoproject.com/en/4.1/ref/class-based-views/generic-display/). This method will be called by all views to determine the queryset. To maintain backward compatibility, this method will by default simply return the `queryset` class attribute. ### Use case This change enables the execution of custom logic based on the incoming request when determining the starting queryset for a review. ### Database changes _No response_ ### External dependencies _No response_
adam added the status: acceptedtype: featuretopic: plugins labels 2025-12-29 20:19:55 +01:00
adam closed this issue 2025-12-29 20:19:55 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7158