Closed johnthagen closed 4 years ago
Hm. I'm not sure if it's within scope.
If you serialize it via a Serializer, you might be able to fetch it by calling prefetch
directly and giving it a Queryset and a serializer. That should perform all of the correct prefetches. The new docs might show you how to do that.
If you have a specific object you need to serialize though, aka not a queryset there's no way to do that right now.
After some more digging, I believe I found that I was interpreting the results from django-debug-toolbar
incorrectly, and this is actually not an issue.
I've seen an issue where if a large nested object is POSTed to the server, the
WritableNestedSerializer
returns the instance it created fromcreate()
and then that object is fetched withoutselect_related
orprefetch_related
applied to it.Using
AutoPrefetchViewSetMixin
, the GET requests are all prefetched correctly but responses from POSTs are not. Is this something within scope for this project or is there some other kind of work around?