I am using django 1.7.1 and trying to use a Prefetch object according to docs
But I am getting a name error global name 'Prefetch' is not defined. My query looks like this:
prefetch = Observation.objects.prefetch_related(Prefetch('flowers__observations'))
What am I missing here? I cannot find any examples anywhere using the Prefetch object.
I want to use Prefetch because it allows you to pass a custom request. I need to filter the results from prefetch_related, and Prefetch objects are the best way to do this.
source
share