diff --git a/docs/authorization.rst b/docs/authorization.rst index bc88cda..57817eb 100644 --- a/docs/authorization.rst +++ b/docs/authorization.rst @@ -144,6 +144,16 @@ If you are using ``DjangoObjectType`` you can define a custom `get_queryset`. return queryset.filter(published=True) return queryset +.. warning:: + + Defining a custom ``get_queryset`` gives the guaranteed it will be called + when resolving the ``DjangoObjectType``, even through related objects. + Note that because of this, benefits from using ``select_related`` + in objects that define a relation to this ``DjangoObjectType`` will be canceled out. + In the case of ``prefetch_related``, the benefits of the optimization will be lost only + if the custom ``get_queryset`` modifies the queryset. For more information about this, refers + to Django documentation about ``prefetch_related``: https://docs.djangoproject.com/en/4.2/ref/models/querysets/#prefetch-related. + Filtering ID-based Node Access ------------------------------