[Answer]-In a Django template, how do I access attributes of a dict element whose key has a space?

1👍

You can use with:

{{ with forms|get:'Foot And Mouth Disease' as item }}
{{ item.element }}
{{ endwith }}

But a better way might be to change your filter into an assignment tag, which adds the item into the context directly.

Leave a comment