[Fixed]-How to use dictionary in django template

1👍

The following line looks wrong:

# Here, dictt[e] is a set that contains coupon_code.coupon_code and w.service_type
dictt.update({e:{coupon_code.coupon_code,w.service_type}})

Instead, write:

dictt.update({e: coupon_code.coupon_code})

0👍

You should use dictionary like this:

{% for key, value in dict.items %}
  {{key}}-{{value}}
{% endfor %}

Leave a comment