[Answered ]-How to apply select_related to the objects of a m2m relationship in Django?

1👍

You can work with a Prefetch object [Django-doc]:

from django.db.models import Prefetch

Aaaaa.objects.prefetch_related(
    Prefetch('b', Bbbbb.objects.select_related('c'))
)

Leave a comment