2👍
✅
The Location
class should have fields or properties that give you the relevant ratings / comments / images. Then you can just pass a list of Location
s to your template.
If Location
is a Django model, then the ratings / comments / images should each have a ForeignKey
that points to Location
. In that case, Django will create properties on Location
that point to the corresponding ratings / comments / images. Use related_name
to choose the name of that property, otherwise Django will invent a name.
Source:stackexchange.com