title: key error value 0 on modelformset when queryset is empty
body: <p>i want to create multiple instances of a model using a modelformset.
  but when the queryset is empty and the parameter <code>extra</code> is greater than 0 it raises this error:</p>
  
  <pre><code>    Environment:
  
  
  Request Method: GET
  Request URL: http://localhost:8000/alta_socies/proces_alta_projecte_autoocupat/adreces/
  
  Django Version: 1.7.7
  Python Version: 2.7.9
  Installed Applications:
  ('django.contrib.admin',
  'django.contrib.auth',
  'django.contrib.contenttypes',
  'django.contrib.sessions',
  'django.contrib.messages',
  'django.contrib.staticfiles',
  'django.contrib.formtools',
  'inici',
  'alta_socies',
  'empreses',
  'socies')
  Installed Middleware:
  ('django.contrib.sessions.middleware.SessionMiddleware',
  'django.middleware.common.CommonMiddleware',
  'django.middleware.csrf.CsrfViewMiddleware',
  'django.contrib.auth.middleware.AuthenticationMiddleware',
  'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
  'django.contrib.messages.middleware.MessageMiddleware',
  'django.middleware.clickjacking.XFrameOptionsMiddleware')
  
  
  Template error:
  In template /home/usergci/gestioci/alta_socies/templates/alta_socies/proces_alta_autoocupat.html, error at line 59
     0
     49 :     &lt;div class="row"&gt;
  
  
     50 :         &lt;div class="medium-12 columns content"&gt;
  
  
     51 :             &lt;div class="row"&gt;
  
  
     52 :                 &lt;div class="medium-12 columns"&gt;
  
  
     53 :                     &lt;div class="group"&gt;
  
  
     54 :                         &lt;h2&gt;{{ projecte.pas }}&lt;/h2&gt;
  
  
     55 :                         {% block explicacio_pas %}{% endblock %}
  
  
     56 :                     &lt;/div&gt;
  
  
     57 :                     &lt;form method="post" action=""&gt;{% csrf_token %}
  
  
     58 :                     {{ wizard.management_form }}
  
  
     59 :                      {% if wizard.form.forms %}
  
  
     60 :                             {{ wizard.form.management_form }}
  
  
     61 :                         {% for form in wizard.form.forms %}
  
  
     62 :                             {% block step_factory_form %}
  
  
     63 :                             {% endblock %}
  
  
     64 :                         {% endfor %}
  
  
     65 :                     {% else %}
  
  
     66 :                         {% block step_single_form %}
  
  
     67 :                         {% endblock %}
  
  
     68 :                     {% endif %}
  
  
     69 :                     &lt;input class="small radius button" type="submit" name="save_only" value="Guardar y salir"/&gt;
  
  
  Traceback:
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
    137.                 response = response.render()
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/response.py" in render
    103.             self.content = self.rendered_content
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/response.py" in rendered_content
    80.         content = template.render(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/base.py" in render
    148.             return self._render(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/base.py" in _render
    142.         return self.nodelist.render(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/base.py" in render
    844.                 bit = self.render_node(node, context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    80.             return node.render(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
    126.         return compiled_parent._render(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/base.py" in _render
    142.         return self.nodelist.render(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/base.py" in render
    844.                 bit = self.render_node(node, context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    80.             return node.render(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
    126.         return compiled_parent._render(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/base.py" in _render
    142.         return self.nodelist.render(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/base.py" in render
    844.                 bit = self.render_node(node, context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    80.             return node.render(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
    126.         return compiled_parent._render(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/base.py" in _render
    142.         return self.nodelist.render(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/base.py" in render
    844.                 bit = self.render_node(node, context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    80.             return node.render(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/defaulttags.py" in render
    402.         return strip_spaces_between_tags(self.nodelist.render(context).strip())
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/base.py" in render
    844.                 bit = self.render_node(node, context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    80.             return node.render(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
    65.                 result = block.nodelist.render(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/base.py" in render
    844.                 bit = self.render_node(node, context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    80.             return node.render(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
    65.                 result = block.nodelist.render(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/base.py" in render
    844.                 bit = self.render_node(node, context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    80.             return node.render(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/defaulttags.py" in render
    305.                     match = condition.eval(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/defaulttags.py" in eval
    898.         return self.value.resolve(context, ignore_failures=True)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/base.py" in resolve
    596.                 obj = self.var.resolve(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/base.py" in resolve
    734.             value = self._resolve_lookup(context)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/template/base.py" in _resolve_lookup
    770.                         current = getattr(current, bit)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/utils/functional.py" in __get__
    55.         res = instance.__dict__[self.func.__name__] = self.func(instance)
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/forms/formsets.py" in forms
    141.         forms = [self._construct_form(i) for i in xrange(self.total_form_count())]
  File "/home/usergci/.virtualenvs/heteroceras/local/lib/python2.7/site-packages/django/forms/models.py" in _construct_form
    591.                 kwargs['initial'] = self.initial_extra[i - self.initial_form_count()]
  
  Exception Type: KeyError at /alta_socies/proces_alta_projecte_autoocupat/adreces/
  Exception Value: 0
  </code></pre>
  
  <p>the offending lines as far as i debugged are:</p>
  
  <pre><code>    AdrecesFormSet = modelformset_factory(AdrecaProjecteAutoocupat,
                                        form=FormulariAdrecaProjecteAutoocupat,
                                        can_delete=True)
  </code></pre>
  
  <p>any hint?</p>