id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 10821 [patch] Add new template tag to test 'foo in bar' tomevans222 nobody "There is currently no way for a template to test whether a value is in a list or not. This is quite a useful tag to have, when drawing tables for example: {{{ ctxt = { 'my_colours': ['orange', 'yellow'], 'all_colours': ['red', 'orange', 'yellow', 'green', blue', 'indigo', 'violet'] } }}} {{{ {% for clr in all_colours %}{{ clr }}{% endfor %} {% for clr in all_colours %} {% IfInList clr in my_colours %}I like it{% else %}I hate it{% endif %} {% endfor %} }}} Attached file adds functionality, but (as I need this now) it follows the style I use for my supplementary tag libraries (camel case node name, 2 space indents, standalone) so would need to be polished slightly to go in django/template/defaulttags.py" closed Template system 1.0 duplicate Unreviewed 1 0 0 0 0 0