I\'d like to use a variable as an key in a dictionary in a Django template. I can\'t for the life of me figure out how to do it. If I have a product with a name or ID field,
You need to prepare your data beforehand, in this case you should pass list of two-tuples to your template:
{% for product, rating in product_list %} {{ product.name }}{{ rating }} {% endfor %}
{{ rating }}