title: Error : Invalid block tag: 'else', expected 'empty' or 'endfor'
body: <p>I'm currently doing some starting stuff on Django 1.3.1 and following error struck me for 2 hours. Help me in figuring out the error. I have included my code on <a href="https://bitbucket.org/nnpkandgmailcom/startthedark/src" rel="nofollow">bitbucket</a>. </p>
  
  <p>Error:-</p>
  
  <pre><code>TemplateSyntaxError at /events/archive/
  Invalid block tag: 'else', expected 'empty' or 'endfor'
  </code></pre>
  
  <p><strong>Template error</strong></p>
  
  <p>In template /home/virus/py_tut/startthedark/startthedark/templates/events/archive.html, error at line 32</p>
  
  <p><strong>Invalid block tag: 'else', expected 'empty' or 'endfor'</strong></p>
  
  <pre><code>22                  {% csrf_token %}
  23                  &lt;input type="hidden" name="event_id" value="{{event.id}}"/&gt;
  24                  {% if attending %}
  25                  &lt;input class="attendance unattend" type = "submit" value = "Unattend" /&gt;
  26                  {% else %}
  27                  &lt;input class = "attendance attend" type ="submit" value = "Attend"/&gt;
  28                  {% endif %}
  29              &lt;/form&gt;
  30              --&gt;
  31          {% endfor %}        
  32      {% else %}
  33          &lt;p&gt;No events for today.&lt;/p&gt;
  34      {% endif %}
  35  
  36  {% endblock %}
  37  
  </code></pre>
  
  <p>Archive.html</p>
  
  <pre><code>{% extends "base.html" %}
  {% load events_tags %}   
  {% block title %}Archive -{{ block.super}}{% endblock %}
  {% block main_content %}
      &lt;a href="{% url ev_create %}"&gt;Create an Event&lt;/a&gt;
      {% if events %}
          {% for e in events %}
              {% event e %}
                  {% endfor %}        
      {% else %}
          &lt;p&gt;No events for today.&lt;/p&gt;
      {% endif %}
  
  {% endblock %}
  </code></pre>
  
  <p>events_tags.py</p>
  
  <pre><code>from django import template
  from events.models import Attendance
  def event(context, e):
      to_return = {
      'event' : e,
      #'request': context['request'],
      }
      if context['user'].is_authenticated():
          try:
              Attendance.objects.get(event=e,user = context['user'])#request.user)
              attending = True
          except Attendance.DoesNotExist:
              attending = False
          to_return.update({
              'attending':attending,
              'authenticated':True,
          })
      else:
          to_return['authenticated'] = False
      return to_return
  
  register = template.Library()
  
  register.inclusion_tag('events/event.html',takes_context=True)(event)
  </code></pre>