John Smith John Smith - 1 year ago 49
Python Question

How do I parse this data in a Django template?

{u'4th-of-July': {'name': 4th of July', 'slug': u'4th-of-July'}}

I would like to have access to
in a django HTML template. How do I go about doing this?

Answer Source

You can access a dict in template with dot notation:

Let's call your dictionary data:

{{ }}


{{ data.4th-of-July.slug }}