Checking if something exists in items of list variable in Django template
问题 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. {% if s.name == "Social" for s in sections %} Hello Social! {% endif %} 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? ADDITIONAL INFO: I could potentially have multiple