title: Django form test generates error with a foreign key model field
body: <p>Have a problem testing a filed form. In field that is defined with <strong>models.ForeignKey</strong> the test generates an error.</p>
  
  <p>The field <strong>gender_opt</strong> is defined in <strong>models.py</strong> as</p>
  
  <pre><code>class Patient(models.Model):
      gender_opt = models.ForeignKey(GenderOption, null=False, blank=False)
  </code></pre>
  
  <p>with ForeignKey given by</p>
  
  <pre><code>class GenderOption(models.Model):
      gender_txt = models.CharField(max_length=50)
  </code></pre>
  
  <p>In my forms.py I have</p>
  
  <pre><code>class PatientForm(ModelForm):
  class Meta:
      model = Patient
  
  fields = [
           other fields
          'gender_opt'
      ]
  
  widgets = {
  other widgets
  
  'gender_opt': Select(attrs={'class': 'form-control', 'id': 'gender_id', 'required': "",
                                       'data-error': "Gender must be filled"}),
  }
  </code></pre>
  
  <p>and my <strong>test.py</strong> is</p>
  
  <pre><code>from django.test import TestCase
  from django.contrib.auth.models import *
  
  class FormValidation(TestCase):
  def test_patient_add_ok(self):
      """test save patient data successfuly"""
  
      data = {u'cpf_id': [u'248.215.628-98'], u'state_txt': [u'RJ'], 
              u'citizenship_txt': [u'BR'], u'name_txt': [u'Test pacient'],
              u'date_birth_txt': [u'15/01/2003'], u'country_txt': [u'BR'],
              u'gender_opt': [u'1']}
  
  
      response = self.client.post('/quiz/patient/new/', data)
      errors = response.context['patient_form'].errors
  </code></pre>
  
  <p>In <strong>errors</strong>, I got the follow message:</p>
  
  <pre><code>Select a valid choice. That choice is not one of the available choices.
  </code></pre>
  
  <p>The URL '/quiz/patient/new/' in <strong>test.py</strong> points to the view (in views.py)</p>
  
  <pre><code>def patient_create(request, template_name="quiz/register.html"):
  
     gender_options = GenderOption.objects.all()
  
     patient_form = PatientForm()
  
  if request.method == "POST":
  
      patient_form = PatientForm(request.POST)
  
      if patient_form.is_valid():
          new_patient = patient_form.save(commit=False)
          new_patient.save()
  
  
  
  context = {'patient_form': patient_form,
             'gender_options': gender_options,
  }
  
  return render(request, template_name, context)
  </code></pre>
  
  <p>I suppose the problem is models.ForeignKey field type.</p>
  
  <p>Appreciate any help.</p>