1👍
✅
You need to reverse query the scores. Since you’ve defined related names in your models, you can use them.
Note that a reverse query gives you a manager object. The all
method returns a queryset with all objects matching the reverse query (you defined a one-to-many relationship, one question/vendor can have many scores). Then further filter the queryset to get the instance you need (e.g. first
).
{{vendor.scorevendor.all.first.score}}
Source:stackexchange.com