title: Advanced Django Template Logic
body: <p>I'm not sure if this is really easy and I just glanced over it in the documentation, or if this is a limitation of the Django template system, but I need to be able to do a little (not very) advanced logic in Django, and I'd rather not have to repeat myself all over. </p>
  
  <p>Let's say I have 3 boolean values; A, B, and C.</p>
  
  <p>I basically need to do: </p>
  
  <pre><code>{% if A and (B or C) %}
      {{ do stuff }}
  {% endif %}
  </code></pre>
  
  <p>However Django doesn't seem to allow grouping the <code>(B or C)</code> logic with parentheses. Is there a way to do that kind of grouping in Django's template language? Or do I need to do the un-DRY version of that, which would be:</p>
  
  <pre><code>  {% if A and B %}
          {{ do stuff }}
    {% else %}
        {% if A and C %}
            {{ do the same stuff }}
        {% endif %}
    {% endif %}
  </code></pre>