title: Django 'ModelForm' object has no attribute 'cleaned_data' for M2M through
body: <p>Hi everyone I'm facing issues with create a M2M through.</p>
  
  <p>With the code below, I get the message:
  'SendCandForm' object has no attribute 'cleaned_data'</p>
  
  <p>If I change </p>
  
  <pre><code>#forms.py
  cojobs=Company.objects.select_related('job').values_list('job__title', flat=True)
  </code></pre>
  
  <p>To</p>
  
  <pre><code>#forms.py
  cojobs=Company.objects.select_related('job__id').values_list('job__id', flat=True)
  </code></pre>
  
  <p>And </p>
  
  <pre><code>#views.py
  job = form.cleaned_data['job']
  status = form.cleaned_data['status']
  </code></pre>
  
  <p>To</p>
  
  <pre><code>#views.py
  job = form.data.get('job')
  status = form.data.get('status')
  </code></pre>
  
  <p>When data exists(), everything goes right. But when it tries to make the post, I get the error:</p>
  
  <pre><code>Cannot assign "u'2'": "CandidateToJob.job" must be a "Job" instance. 
  </code></pre>
  
  <p>Hope you can help me.</p>
  
  <p>Here is my code</p>
  
  <pre><code>#models.py
  class Company(models.Model):
      user = models.OneToOneField(User, primary_key=True)
      name = models.CharField(max_length=50)
      ...
  
  class Job(models.Model):
      company = models.ForeignKey(Company)
      candidate = models.ManyToManyField('Candidate', through='CandidateToJob')
      title = models.CharField(max_length=500)
      ...
  
  class Candidate(models.Model):
      user = models.OneToOneField(User, primary_key=True)
      ...
  
  class CandidateToJob(models.Model):
      job = models.ForeignKey(Job, related_name='applied_to')
      candidate = models.ForeignKey(Candidate, related_name='from_user')
      STATUS_CHOICES = (
          ('0', 'New'),
          ('1', 'Not approved'),
          ('2', 'Approved')
       )
      status = models.CharField(max_length=2, choices=STATUS_CHOICES)
  </code></pre>
  
  <p>The form</p>
  
  <pre><code>#forms.py
  class SendCandForm(ModelForm):
  
      cojobs=Company.objects.select_related('job').values_list('job__title', flat=True)
      cojobs_choices = [('', 'Choose')] + [(id, id) for id in cojobs]
  
      job = forms.ChoiceField(choices=cojobs_choices ,label="Vaga", required=True, widget=forms.Select(attrs={'class': 'form-control'}))
  
      STATUS_CHOICES = (
          ('0', 'New'),
          ('1', 'Not approved'),
          ('2', 'Approved')
       )
      status = forms.ChoiceField(required=True, widget=forms.RadioSelect(attrs={'class': ''}), choices=STATUS_CHOICES)
  
      class Meta:
      model = CandidateToJob
          exclude = ['candidate']
  </code></pre>
  
  <p>Here is my view</p>
  
  <pre><code>#views.py
  class MyCandidateDetail(SuccessMessageMixin, UpdateView):
  
      model = Candidate
      template_name = 'dashboard/my-candidate-detail.html'
      form_class = SendCandForm
  
      def get_context_data(self, **kwargs):
          context = super(MyCandidateDetail, self).get_context_data(**kwargs)
          return context
  
      def get_initial(self, *args, **kwargs):
          candidate = self.get_object()
          self.initial = {'candidate': candidate}
          return self.initial
  
      def get_form_kwargs(self, *args, **kwargs):
          kwargs = {'initial': self.get_initial()}
          return kwargs
  
      def post(self, request, *args, **kwargs):
  
          form = self.form_class(request.POST)
  
          #get job and status from form
          job = form.cleaned_data['job']
          status = form.cleaned_data['status']
  
          #get candidate
          candidate = self.get_object()
  
          #check if objects exists before save
          if CandidateToJob.objects.filter(job = job, candidate = candidate).exists():
  
              messages.error(request, 'Error!')
  
              return HttpResponseRedirect(reverse('mycandidatedetail', kwargs={'pk': candidate.pk}))
  
          else:
  
              if form.is_valid():
                  form.save(commit=False)
  
                  #assign to the through table
                  candidatetojob = CandidateToJob.objects.create(job=job, candidate=candidate, status=status)
  
                  candidatetojob.save()
  
                  messages.success(request, 'Success!')
  
              return HttpResponseRedirect(reverse('mycandidatedetail', kwargs={'pk': candidate.pk}))
  </code></pre>