title: Submitting data from 1 table to another table
body: <p>I am trying to submit data from a checklist using forms. The checklist is generated from a database table and after submission the checked items are inserted into another database table. I am getting the error as <em>form is invalid.</em></p>
  <p>This is my models.py CustomStudent is the database from where I am taking value and Reports is the database where I am submitting values</p>
  <pre><code>class CustomStudent(models.Model):
      _id = models.AutoField
      sname = models.CharField(max_length = 50)
      slname = models.CharField(max_length = 50)
      password = models.CharField(max_length = 255, default = '')
  
      def __str__(self):
          return str(self.slname)
          return str(self.sname)
  
  class Report(models.Model):
      # _id = models.AutoField()
      tname = models.CharField(max_length = 100)
      sname = models.CharField(max_length = 100)
      fdate = models.DateField()
      tdate = models.DateField()
      dailydate = models.DateField()
      objective = models.CharField(max_length = 512)
      tplan = models.CharField(max_length = 512)
      how = models.CharField(max_length = 512)
      material = models.CharField(max_length = 512)
      extra = models.CharField(max_length = 512)
      topic = models.CharField(max_length = 512)
      pftd = models.CharField(max_length = 512)
      activity = models.CharField(max_length = 512)
      comment = models.CharField(max_length = 512)
      thought = models.CharField(max_length = 512)
      admin_comment = models.CharField(max_length = 255)
      
      def __str__(self):
          return str(self.tname)
          return str(self.sname)
  </code></pre>
  <p>This is code from my forms.py to use the database.</p>
  <pre><code>sname = forms.ModelMultipleChoiceField(queryset=CustomStudent.objects.all().values_list('sname', flat=True), required = False,  widget =forms.CheckboxSelectMultiple( attrs ={'class':' form-check-input'  ' form-check-inline'}))
  </code></pre>
  <p>This error is generated due to the value of the checklist string is returning in double quotes. ex. &quot;student&quot; from 1st database.</p>
  <p>I have tried splitting string to remove double quotes but even that doesn't help.</p>