title: how to insert multiple records in django?
body: <p><strong>views.py</strong> </p>
  
  <pre><code>def input_transaksi(request):    
      kode_pem = dict(request.POST)['kode_pem']
      nominal = dict(request.POST)['nominal']
      rincian = Transaksi(kode_pem=kode_pem,nominal=nominal)
      rincian.save()
  </code></pre>
  
  <p><strong>model.py</strong></p>
  
  <pre><code>class Transaksi(models.Model):
      nominal = models.IntegerField(null=True, blank=True)
      kode_pem = models.CharField(max_length=2, null=True, blank=True)
  </code></pre>
  
  <p>Then I input data from this form</p>
  
  <pre><code>{% for t in trans %} #for looping form
      &lt;from  method="post" action="{% url 'input_transaksi' %}" enctype="multipart/form-data"&gt;    
      &lt;input type="hidden" name="kode_pem"&gt;           
          &lt;input type="hidden" name="nominal"&gt;
      &lt;input type="submit" value="Insert" class="btn btn-primary"&gt;
      &lt;/form&gt;
  {% endfor %}
  </code></pre>
  
  <p>But I get this error:</p>
  
  <pre><code>Environment: Request Method: POST Request URL: http://localhost:8000/transaksi/input_transaksi
  
  Django Version: 1.10.4 Python Version: 2.7.11 Installed Applications: ['django.contrib.admin',  'django.contrib.auth',  'django.contrib.contenttypes',  'django.contrib.sessions',  'django.contrib.messages',  'django.contrib.staticfiles',  'django.contrib.humanize',  'datapribadisiswa',  'riwayatsekolah',  'riwayatprestasi',  'dataguru',  'biaya_pendidikan',  'transaksi_kas', 'kodepembayaran',  'django_ajax',  'import_export'] Installed Middleware: ['django.middleware.security.SecurityMiddleware',  'django.contrib.sessions.middleware.SessionMiddleware',  'django.middleware.common.CommonMiddleware',  'django.middleware.csrf.CsrfViewMiddleware',  'django.contrib.auth.middleware.AuthenticationMiddleware',  'django.contrib.messages.middleware.MessageMiddleware',  'django.middleware.clickjacking.XFrameOptionsMiddleware']
  
  
  
  Traceback:
  
  File "C:\Python27\lib\site-packages\django-1.10.4-py2.7.egg\django\core\handlers\exception.py" in inner
    39.             response = get_response(request)
  
  File "C:\Python27\lib\site-packages\django-1.10.4-py2.7.egg\django\core\handlers\base.py" in _legacy_get_response
    249.             response = self._get_response(request)
  
  File "C:\Python27\lib\site-packages\django-1.10.4-py2.7.egg\django\core\handlers\base.py" in _get_response
    187.                 response = self.process_exception_by_middleware(e, request)
  
  File "C:\Python27\lib\site-packages\django-1.10.4-py2.7.egg\django\core\handlers\base.py" in _get_response
    185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)
  
  File "C:\Users\Lenovo\OneDrive\siswa\transaksi_kas\views.py" in input_transaksi
    1213.     rincian.save()
  
  File "C:\Python27\lib\site-packages\django-1.10.4-py2.7.egg\django\db\models\base.py" in save
    796.                        force_update=force_update, update_fields=update_fields)
  
  File "C:\Python27\lib\site-packages\django-1.10.4-py2.7.egg\django\db\models\base.py" in save_base
    824.             updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  
  File "C:\Python27\lib\site-packages\django-1.10.4-py2.7.egg\django\db\models\base.py" in _save_table
    908.             result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  
  File "C:\Python27\lib\site-packages\django-1.10.4-py2.7.egg\django\db\models\base.py" in _do_insert
    947.                                using=using, raw=raw)
  
  File "C:\Python27\lib\site-packages\django-1.10.4-py2.7.egg\django\db\models\manager.py" in manager_method
    85.                 return getattr(self.get_queryset(), name)(*args, **kwargs)
  
  File "C:\Python27\lib\site-packages\django-1.10.4-py2.7.egg\django\db\models\query.py" in _insert
    1045.         return query.get_compiler(using=using).execute_sql(return_id)
  
  File "C:\Python27\lib\site-packages\django-1.10.4-py2.7.egg\django\db\models\sql\compiler.py" in execute_sql
    1053.             for sql, params in self.as_sql():
  
  File "C:\Python27\lib\site-packages\django-1.10.4-py2.7.egg\django\db\models\sql\compiler.py" in as_sql
    1006.                 for obj in self.query.objs
  
  File "C:\Python27\lib\site-packages\django-1.10.4-py2.7.egg\django\db\models\sql\compiler.py" in prepare_value
    945.             value = field.get_db_prep_save(value, connection=self.connection)
  
  File "C:\Python27\lib\site-packages\django-1.10.4-py2.7.egg\django\db\models\fields\__init__.py" in get_db_prep_save
    755.                                       prepared=False)
  
  File "C:\Python27\lib\site-packages\django-1.10.4-py2.7.egg\django\db\models\fields\__init__.py" in get_db_prep_value
    747.             value = self.get_prep_value(value)
  
  File "C:\Python27\lib\site-packages\django-1.10.4-py2.7.egg\django\db\models\fields\__init__.py" in get_prep_value
    1832.         return int(value)
  
  Exception Type: TypeError at /transaksi/input_transaksi Exception Value: int() argument must be a string or a number, not 'list'
  </code></pre>
  
  <p>How can I resolve it?</p>