title: How to update multiple objects by one html request?
body: <p>I have a problem and can't find a decision.
  I need to update a value for several objects by one form. If I did it one by one, without submit button it works fine. But I want to do it by click to one button.</p>
  
  <p>My HTML form:</p>
  
  <pre><code>&lt;form method="post" action="{% url 'installmentreport-update' %}"&gt;
     {% for installmentreport in installment.installmentreport_set.all %}
        &lt;tr&gt;
          &lt;td class="align-middle" style="text-align:center"&gt;{{installmentreport.title}}&lt;/td&gt;
          &lt;td class="align-middle" style="text-align:center"&gt;
              {% csrf_token %}
          &lt;input type="number" name='spent' value={{installmentreport.spent}} placeholder={{installmentreport.spent}} size="8"&gt;
          &lt;input type="hidden" name='id' value={{installment.id}}&gt;&lt;/td&gt;
          &lt;input type="hidden" name='pk' value={{installmentreport.id}}&gt;
  
        &lt;/tr&gt;
      {% endfor %}
      &lt;td&gt;&lt;/td&gt;
      &lt;td class="align-middle" style="text-align:center"&gt;&lt;input type="submit" class="btn btn-warning" name="submit" value="Update"&gt;&lt;/form&gt;
  </code></pre>
  
  <p>Views:</p>
  
  <pre><code>class InstallmentReportUpdate(LoginRequiredMixin,PermissionRequiredMixin,UpdateView):
      model = InstallmentReport
      permission_required = 'catalog.can_change_program'
      fields = ['spent']
  
      def get_object(self):
          pks = self.request.POST.getlist('pk')
  
          for pk in pks:
              return InstallmentReport.objects.get(pk=pk)
  
              def form_valid(self, form):
                  if self.request.method == 'POST':
                      spents = self.request.POST.getlist('spent')
                      if form.is_valid():
                          for spent in spents:
                              instance = form.save(commit=False)
                              form.instance.spent = spent
                              instance.save()
                          return super().form_valid(form)
  
      def get_success_url(self):
          id = self.request.POST.get('id')
          return reverse('installment-detail-owner', args=[str(id)])
  
  </code></pre>
  
  <p>I use Python3.7 and Django2.2</p>