Hello,
I was hoping someone could steer me in the right direction regarding attribute lazy evaluation and async. I’m not sure if I’m doing something wrong or missing something?
Say I query a parent model that contains a link to a child model.
parent_model = await ParentModel.objects.afirst()
If I try to access parent_model.child Django tries to go off to the database to pull in the child model. This results in an SynchronousOnlyOperation error. I’m assuming this is because the implicit query that’s executed to fetch the child attribute is being executed as sync
I can force the child to be included in the query by adding “select_related” but that ends up negating the whole point of lazy evaluation.
I can’t find a lot about this in the docs or in general so I’m thinking I’m missing something fundamental?