django - I have a list of objects and would like to return an attribute with another attribute -
if objects {(title: 'one', content: 'foo'), (title: 'two', content: 'bar')} how go getting 'for' , 'bar' template?
something this:
{% content in content_list content.title='one'} {{ content.content }} resulting in 'foo'.
{% content in content_list content.title='two'} {{ content.content }} resulting in 'bar'.
try -
{% content in content_list %} {% if content.title == 'two' %} {{ content.content }} {% else %} {{ content.content }} {% endif %} {% endfor %} note: if list small
Comments
Post a Comment