title: Django CreateView get_initial Foreign Key
body: <p>I have a form and I am trying to use the <code>get_initial</code> method to set a foreign key. The model is</p>
  
  <pre><code>class CardioRecord(models.Model):
      date_uploaded = models.DateField(auto_now=True)
      client = models.ForeignKey(User, on_delete=models.CASCADE)
      run_dist = models.FloatField(blank=True, null=True)
      run_time = models.FloatField(blank=True, null=True)
  </code></pre>
  
  <p>The form is</p>
  
  <pre><code>class CardioRecordForm(forms.ModelForm):
          class Meta:
              model = CardioRecord
              fields = [
                          'client',
                        'run_dist',
                        'run_time',
                        ]
              labels = {
                  'run_dist': 'Distance (km)',
                  'run_time': 'Time (min)',
              }
              widgets = {
                  'client': forms.HiddenInput()
              }
  </code></pre>
  
  <p>The view is</p>
  
  <pre><code>class CardioCreateView(CreateView):
      model = CardioRecord
      form_class = CardioRecordForm
      template_name = 'training/cardio_form.html'
  
      def get_initial(self):
          initial = super(CardioCreateView, self).get_initial()
          initial['client'] = self.request.user.pk
          return initial
  </code></pre>
  
  <p>and the error that I am getting is </p>
  
  <pre><code>null value in column "client_id" violates not-null constraint
  </code></pre>
  
  <p>which looks like the initial value is not being passed to the form. How do I pass the Foreign Key to the form?</p>