title: validation errors on ModelChoiceField
body: <p>I have validation errors in my django formset. Two drop down lists, populated from the database, do not pass the validation, and I don't understand what's my mistake.</p>
  
  <p><img src="https://i.stack.imgur.com/CgmqM.png" alt="enter image description here"></p>
  
  <p><strong>model</strong>:</p>
  
  <pre><code>class Country(models.Model):
      country_code=models.CharField(max_length=2, primary_key=True)
      country=models.CharField(max_length=20, unique=True)
  
      def __unicode__(self):
          return u"%s" % self.country
  
  class Status(models.Model):
      verbatim = models.ForeignKey(Verbatim)
      country = models.ForeignKey(Country)
      status = models.CharField(max_length=5, db_index=True)
  
      def __unicode__(self):
          return u"%s" % self.status
  
      class Meta:
          unique_together=(("verbatim", "country"), )
  
  class ImportMinAttend(models.Model):
      country=models.CharField(max_length=2, blank=False, null=False)
      verbatim=models.CharField(max_length=250, blank=False, null=False)
      status=models.CharField(max_length=5, blank=True, null=True, default=None)
  </code></pre>
  
  <p><strong>form</strong>:</p>
  
  <pre><code>class MinAttendForm(forms.ModelForm):
      country=forms.ModelChoiceField(queryset=Country.objects.all(), empty_label="Select a country")
      status=forms.ModelChoiceField(queryset=Status.objects.values_list('status', flat = True).distinct(), empty_label="Select a status")
      class Meta:
          model=ImportMinAttend
          #fields used for the validation
          fields = ('country', 'verbatim', 'status')
  </code></pre>
  
  <p><strong>view</strong>:</p>
  
  <pre><code>class MinAttendUpdate(UpdateView):
      model = ImportMinAttend
      fields = ['country', 'verbatim', 'status']
      form_class=MinAttendForm
  
      def post(self, request, *args, **kwargs):
          ...
          MinAttendFormSet = modelformset_factory(self.model, form=self.form_class, fields=self.fields, extra=len(attendances), max_num=len(attendances)+self.nb_extra_forms)
          formset=MinAttendFormSet(request.POST, queryset=attendances)
          ...
  </code></pre>
  
  <p>Source code of the first country select:</p>
  
  <pre><code>&lt;select name="form-0-country" id="id_form-0-country"&gt;
  &lt;option value=""&gt;Select a country&lt;/option&gt;
  &lt;option value="AT" selected="selected"&gt;Austria&lt;/option&gt;
  &lt;option value="BE"&gt;Belgium&lt;/option&gt;
  &lt;option value="BG"&gt;Bulgaria&lt;/option&gt;
  ...
  </code></pre>
  
  <p>Source code of the first status select:</p>
  
  <pre><code>&lt;select name="form-0-status" id="id_form-0-status"&gt;
  &lt;option value=""&gt;Select a status&lt;/option&gt;
  &lt;option value="AB"&gt;AB&lt;/option&gt;
  &lt;option value="CS"&gt;CS&lt;/option&gt;
  &lt;option value="M" selected="selected"&gt;M&lt;/option&gt;
  &lt;/select&gt; 
  </code></pre>
  
  <p>About the country select: the value displayed has more than two characters but the key used has exactly 2 characters. Why this validation error?
  About the status, I don't even understand the problem...</p>
  
  <p>Many thanks.</p>
  
  <h2>EDIT: SOLVED:</h2>
  
  <p>I have found "dirty" workarounds.
  For the country select, I use the key of the select, not the value:</p>
  
  <pre><code>def clean_country(self):
          data = self.cleaned_data['country'].pk
          return data
  </code></pre>
  
  <p>For the status select, I delete the validation error if a value is selected:</p>
  
  <pre><code> def clean(self):
          #call status clean method
          self.cleaned_data["status"]=self.clean_status()
          return self.cleaned_data
  
   def clean_status(self):
          #valid if a value has been selected
          if self["status"].value()!="":
              del self._errors["status"]
          return self["status"].value()
  </code></pre>
  
  <p>It works, but why do I have to do this? :(</p>