Is limiting relationships possible? #67
-
Hi, Just trying to get my head around what is and isn't supported, the use case I'm after would be something like an I tried a couple of approaches to no avail:
Let me know if you would prefer questions to be asked on a different platform. Thanks for the library. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi! Thanks for trying out django-readers 😎 I think the question isn't really readers-specific: readers just uses I'll leave this ticket open because I'm very interested to hear how you get on! |
Beta Was this translation helpful? Give feedback.
-
Looks like this is going to be possible in Django 4.2: https://docs.djangoproject.com/en/dev/releases/4.2/#models
cc @simkimsia (re #73) |
Beta Was this translation helpful? Give feedback.
Hi! Thanks for trying out django-readers 😎
I think the question isn't really readers-specific: readers just uses
prefetch_related
to load relationships, so what you need to be able to do is prefetch a limited number of objects. This article suggests a few ways to do it, involvingOuterRef
andSubquery
. If you can get this to work with "just" your queryset (ie without readers) then it should be fairly straightforward to convert this into a reader pair.I'll leave this ticket open because I'm very interested to hear how you get on!