List comprehensions in Jinja : <p>I have two lists:</p>

<ol>
<li>strainInfo, which contains a dictionary element called 'replicateID'</li>
<li>selectedStrainInfo, which contains a dictionary element called 'replicateID'</li>
</ol>

<p>I'm looking to check if the replicateID of each of my strains is in a list of selected strains, in python it would be something like this:</p>

<pre><code>for strain in strainInfo:
    if strain.replicateID in [selectedStrain.replicateID for selectedStrain in selectedStrainInfo]
        print('This strain is selected')
</code></pre>

<p>I'm getting the correct functionality in django, but I'm wondering if there's a way to simplify using a list comprehension:</p>

<pre><code>{% for row in strainInfo %}
    {% for selectedStrain in selectedStrainsInfo %}
       {% if row.replicateID == selectedStrain.replicateID %} 
           checked 
       {% endif %}
    {% endfor %}
{% endfor %}
</code></pre>
