Re: Prefetching returning empty values for some object

2019-12-30 Thread Simon Charette
I suspect your usage of `distinct('path')` is causing issues during prefetching here as it will prevent different File with the same .path from being prefetched for two different folder objects. You likely want to use `distinct('path', 'folder')` here instead where 'folder' might have a differe

Prefetching returning empty values for some object

2019-12-29 Thread Mohit Solanki
Assume these two models. class Folder(model): name = models.CharField(max_length=8) files = models.ManyToManyField('File') class File: path = models.CharField(max_length=255) First I was fetching the folders and while looping over them fetching the files with a distinct path folders