Skip to content
Advertisement

Django Render List of Dictionaries to a template

I have a list of dictionaries with same key information. How can I pass this list of dictionaries to a Django template ?

JavaScript

When trying to send this list via views file to template it fails with an error indicating that only dictionaries are allowed.

Here is the code from views file

JavaScript

Here is the html block-

JavaScript

Advertisement

Answer

Just pass these as an entry of the dictionary:

JavaScript

Then in the template, you can render these with:

JavaScript
Advertisement