title: Django: empty formset in template
body: <p>I'm building an application with Django and when using <code>InlineFormSet</code> with <code>ClassBasedViews</code> my <code>route_formset</code> is empty in template, but <code>form</code> is populated with data as it should be. </p>
  
  <p>What am I doing wrong?</p>
  
  <blockquote>
    <p>View</p>
  </blockquote>
  
  <pre><code>class ReservationUpdateView(UpdateView):
      model = Reservation
      form_class = ReservationForm
      success_url = '/'
  
      def get_form_kwargs(self):
          kwargs = super(ReservationUpdateView, self).get_form_kwargs()
          kwargs.update({'request': self.request})
          return kwargs
  
      def get(self, request, *args, **kwargs):
          """
          Handles GET requests and instantiates versions of the form
          and its inline formsets.
          """
          self.object = self.get_object()
          form_class = self.get_form_class()
          form = self.get_form(form_class)
          route_formset = RouteFormSet()
          return self.render_to_response(
              self.get_context_data(form=form,
                                    route_formset=route_formset))
  
      def post(self, request, *args, **kwargs):
          """
          Handles POST requests, instantiating a form instance and its inline
          formsets with the passed POST variables and then checking them for
          validity.
          """
          self.object = self.get_object()
          form_class = self.get_form_class()
          form = self.get_form(form_class)
          route_formset = RouteFormSet(self.request.POST)
          if (form.is_valid() and route_formset.is_valid()):
              return self.form_valid(form, route_formset)
          else:
              return self.form_invalid(form, route_formset)
  
      def form_valid(self, form, route_formset):
          """
          Called if all forms are valid. Creates a Recipe instance along with
          associated Ingredients and Instructions and then redirects to a
          success page.
          """
          self.object = form.save()
          route_formset.instance = self.object
          route_formset.save()
          return HttpResponseRedirect(self.get_success_url())
  
      def form_invalid(self, form, route_formset):
          """
          Called if a form is invalid. Re-renders the context data with the
          data-filled forms and errors.
          """
          return self.render_to_response(
              self.get_context_data(form=form,
                                    route_formset=route_formset))
  </code></pre>
  
  <blockquote>
    <p>Template</p>
  </blockquote>
  
  <pre><code>{% for form in route_formset %}
      &lt;div class="form-group"&gt;
          &lt;label class="col-sm-3 control-label"&gt;Time / Place&lt;/label&gt;
          &lt;div class="col-sm-2"&gt;
              {{ form.time }}
          &lt;/div&gt;
          &lt;div class="col-sm-5"&gt;
              {{ form.place }}
          &lt;/div&gt;
      &lt;/div&gt;
      {% endfor %}
  </code></pre>
  
  <blockquote>
    <p>Formset</p>
  </blockquote>
  
  <pre><code>RouteFormSet = inlineformset_factory(Reservation, Stop, fields=('time','place'), extra=2)
  </code></pre>
  
  <blockquote>
    <p>Result<br>
    <a href="https://i.stack.imgur.com/XAWER.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XAWER.png" alt="enter image description here"></a></p>
  </blockquote>
  
  <p>So the formset should be populated with <code>Stops</code> but it is empty..</p>