title: Running quick if statements in Django template language
body: <p>I'm using this code:</p>
  
  <pre><code>&lt;div class="stream {% if streams.online %}online{% else %}offline{% endif %}"&gt;
  </code></pre>
  
  <p>It seems a little redundant. I'd love to run this code</p>
  
  <pre><code>&lt;div class="stream {{ 'online' if stream.online else 'offline' }}"&gt;
  </code></pre>
  
  <p>But sadly that doesn't work. Is there a shorter and less messy way of doing what I want?</p>