title: Can't get a combination of if and elif to work in django
body: <p>I have two variables, <code>date1</code> and <code>date2</code>, both DateField. Here's what I'm trying to write:</p>
  <ul>
  <li>if <code>date1</code> and <code>date2</code> have values, display &quot;Datation évaluée entre <code>date1</code> et <code>date2</code>&quot;.</li>
  <li>if <code>date1</code> have value but not <code>date2</code>, display &quot;Datation évaluée vers <code>date1</code>&quot;.</li>
  <li>if <code>date2</code> have value but not <code>date1</code>, display &quot;Datation évaluée vers <code>date2</code>&quot;.</li>
  <li>if neither <code>date1</code> nor <code>date2</code> have values, don't display anything.</li>
  </ul>
  <p>Here is my code:</p>
  <pre><code>{% if 'date1' and 'date2' %}  
      Datation évaluée entre {{ object.date1 }} et {{ object.date2 }}.  
  {% elif not 'date1' %}  
      Datation évaluée vers {{ object.date2 }}.  
  {% elif not 'date2' %}  
      Datation évaluée vers {{ object.date1 }}.  
  {% elif not 'date1' or 'date2' %}  
      Datation inconnue.
  </code></pre>
  <p>The first condition appears indeed, but not the others. When there's a value only on one side, I get &quot;Datation évaluée entre <code>value1</code> et None.&quot;, and when there are no values, I get &quot;Datation évaluée entre None et None.&quot;</p>
  <p>Any ideas what's wrong in the code?</p>
  <p>Thanks for your help.</p>