Updating related many-to-many instance after save?


I am building little learning project using DRF where I have places which have products and both of these can have reviews. I have all this set up and want to add field average-rating to both places and products.

I know I could calculate it on the fly but I would like to only update it when reviews for the specific place/product change and then only read it.

What would be the best approach?