You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the only way for users to modify the queryset is by overriding the entire method—something that's discouraged due to maintainability and future compatibility concerns.
Introducing a get_queryset method would allow developers to tailor the queryset for different scenarios (e.g. annotating users who hold a valid license) for further checks and validations, without performing extra database queries.
Uh oh!
There was an error while loading. Please reload this page.
In
JWTAuthentication.get_user
, the user is retrieved using the objects manager directly, without providing an easy way to customize the queryset:djangorestframework-simplejwt/rest_framework_simplejwt/authentication.py
Lines 131 to 136 in acb1483
Currently, the only way for users to modify the queryset is by overriding the entire method—something that's discouraged due to maintainability and future compatibility concerns.
Introducing a
get_queryset
method would allow developers to tailor the queryset for different scenarios (e.g. annotating users who hold a valid license) for further checks and validations, without performing extra database queries.This pattern aligns with how Django REST Framework typically works—it relies on
get_
methods (likeget_queryset
) that return default values unless explicitly overridden:https://github.com/encode/django-rest-framework/blob/c41314f1fc898490f27e1015cc859e28afe6f7b9/rest_framework/generics.py#L52-L92
The text was updated successfully, but these errors were encountered: