i'm trying to prefetch related from parent model to chidren throught the related name, However the queryset in the template still hits the DB in PostgreSQL, my modelB modelC and ModelD all point towards modelA and when I overwrite the generic class based view queryset function it still doesnt affect the size of the query?? any clues ?
*MODEL
class ModelA(models.Model):
title = models.Charfield(max_lenght=200, null=True, Blank=True)
class ModelB(models.Model):
model_a = models.ForeignKey(ModelA, on_delete=models.CASCADE, related_name="model_a_related")
*VIEW
class ModelAView(DetailView):
model = ModelA
def get_queryset(self):
return super().get_queryset().prefetch_related('model_a_related')