title: Checking if something exists in items of list variable in Django template
body: <p>I have a list of sections that I pass to a Django template. The sections have different types. I want to say "if there is a section of this type, display this line" in my template, but having an issue.  What I'm basically trying to do is this.</p>
  
  <pre><code>{% if s.name == "Social" for s in sections %}
      Hello Social!
  {% endif %}
  </code></pre>
  
  <p>But of course that's not working. Any idea how to basically in one line loop through the items in a list and do an if statement?</p>
  
  <p><strong>ADDITIONAL INFO: I could potentially have multiple "Social" sections. What I'm trying to do in the template is say "if there are any social sections, display this div. If not, don't display the div." But I dont want the div to repeat, which is what would happen with the above code.</strong></p>