title: Django Admin - saving data from custom form
body: <p>I need to customize the admin panel added to the model page related inputs from another model​​. But I can not figure out how to save them.</p>
  
  <p>admin.py</p>
  
  <pre><code>class OrderAdmin(admin.ModelAdmin):
      change_form_template = 'admin/testapp/order/change_form.html'
  
      def change_view(self, request, object_id, extra_context=None):
          order = Order.objects.get(id=object_id)
          card_list = Card.objects.all().filter(type=order.type)
          result = super(OrderAdmin, self).change_view(request, object_id, extra_context={
          'card_list': card_list,
          })
          return result
  </code></pre>
  
  <p>change_form.html</p>
  
  <pre><code>    {% for card in card_list %}
      &lt;input type="text" name="card-{{ card.id}}" value="{{ card.qty }}"&gt;&lt;/td&gt;
      {% endfor %}
  </code></pre>
  
  <p>How to save the changed values ​​in the Card model?</p>
  
  <p>I tried to do as described here:
  <a href="https://docs.djangoproject.com/en/1.3/ref/contrib/admin/#adding-custom-validation-to-the-admin" rel="nofollow">https://docs.djangoproject.com/en/1.3/ref/contrib/admin/#adding-custom-validation-to-the-admin</a></p>
  
  <p>But self.cleaned_data does not include my data from inputs.</p>
  
  <p>Thanks.</p>
  
  <p>UPD: Well, I caught the data, but I think it's pretty messy way. 
  I'm hardly can imagine how I would calculate the id from inputs.</p>
  
  <pre><code>def save_model(self, request, obj, form, change):
          request.POST['card-288']
  </code></pre>