Open ad-m opened 4 years ago
I would like pass
Model.objects.select_related('xxx').all()
to paginator. Unfortunatly, you can not useselect_related
andonly
in single query.
Hrm. That's an interesting case. The reason that's there is to avoid having to fully load/serialize the previous page's objects, instead just grabbing the field their paginated with. Removing that only will cause them to all be loaded up and deserialized, and if using a select_related
all of the relations will be as well, just to grab the offset token for the previous page. None of which will be used.
To avoid the extra overhead/hurting the performance of the common/existing case I believe it'd be preferable to add in an extra parameter to the constructor, select_related
that gets added to the qs
here just when building the object_list
and doesn't get applied when finding the previous page.
I would like pass
Model.objects.select_related('xxx').all()
to paginator. Unfortunatly, you can not useselect_related
andonly
in single query. Here is example stacktrace: