title: Invalid block tag: 'else', expected 'empty' or 'endfor' in django template
body: <p>I have a template which has two template variables <code>list_of_books, search_results</code></p>
  
  <p>First i am checking whether results exists for any one of the variables , if not exists it should display <code>Books not available</code> as below</p>
  
  <p>Next if <code>search_results</code> variable has results, we should loop and print the data,
  else if <code>list_of_books</code> variable has results , we should loop and print the data</p>
  
  <pre><code>{% if list_of_books or search_results %}
     &lt;table border="0" align="left" width="70%"&gt; 
      {% if search_results %}
          {% for book in search_results %}
      {% else %}    
          {% for book in list_of_books %}
      {% endif %}    
        &lt;tr&gt;
          &lt;td&gt;  
              &lt;a href="{{ book.get_absolute_url }}"&gt;{{ book.title }}&lt;/a&gt;
          &lt;/td&gt;
            &lt;/tr&gt;
              {% endfor %}
      &lt;/table&gt;
  
  {% else %}
      &lt;p&gt;No Books available.&lt;/p&gt;
  {% endif %}
  </code></pre>
  
  <p>But by the above html code i am getting the below error, actually where i am making mistake in writing template tags ?</p>
  
  <pre><code>Error during template rendering
  
  In template /home/virtualenvironment/apps/books/templates/books/list_of_books.html, error at line 23
  Invalid block tag: 'else', expected 'empty' or 'endfor'
  20  &lt;table border="0" align="left" width="70%"&gt;
  21  {% if search_results %}
  22  {% for book in search_results %}
  23  {% else %}
  24  {% for book in list_of_books %}
  25  {% endif %}
  26  &lt;tr&gt;
  27  &lt;td&gt;
  28  &lt;a href="{{ book.get_absolute_url }}"&gt;{{ book.title }}&lt;/a&gt;
  29  &lt;/td&gt;
  30  &lt;/tr&gt;
  31  {% endfor %}
  32  &lt;/table&gt;
  </code></pre>