Django: filter a model with a field from another model
问题 This is my first Django app. I am trying to display an average rating from multiple reviews. This seems to work in my product template but not on my blog template because productprofile_id is not defined: product_rating = Review.objects.filter(product_id=productprofile_id).aggregate(Avg('rating')).values() How do I filter the Review model with the related_products field in the Blog model? Or is it possible to just include the product view in my Post template? Thanks in advance for your help!