django can we select related a field on a prefetch related model?
django
Solution
You only need one `prefetch_related` call:
foo = A.objects.prefetch_related('a__z').get(pk=1)
This will prefetch both tables. In Django 1.7+ you can improve performance by using a `Prefetch` object, as in koniiiik's answer.
Problem
Assuming these as django model for the sake of simplcity: ``` class A(): a = manytomany('B') class B(): b = charfield() z = foreignkey('C') class C(): c = charfield() ``` Can we do something like this to fetch the `z` also: ``` foo = A.objects.get(pk = 1).prefetch_related('a').select_related('a__z') ```