title: Django Create View Image Upload
body: <p>I'm trying to create a new object in a CreateView via ModelForm. I want the 'player' instance to have a image. But the uploaded image doesn't get stored to the 'player_image'-directory or written in the DB.</p>
  
  <p>These are my files:</p>
  
  <p>models.py:</p>
  
  <pre><code>class Player(models.Model):
      last_name = models.CharField(max_length=255, verbose_name=_("Last Name"))
      first_name = models.CharField(max_length=255, verbose_name=_("First Name"))
      secret_name = models.CharField(max_length=255, verbose_name=_("Secret Key"), unique=True)
      image = ImageField(upload_to='player_images/', verbose_name=_("Image"), null=True, blank=True)
  </code></pre>
  
  <p>player_form.py</p>
  
  <pre><code>class PlayerForm(forms.ModelForm):
      last_name = forms.CharField(required=True, label=_("Last Name"))
      first_name = forms.CharField(required=True, label=_("First Name"))
  
      class Meta:
          model = Player
          fields = ['first_name', 'last_name', 'image']
  </code></pre>
  
  <p>player_add_view.py</p>
  
  <pre><code>class PlayerAddView(LoginRequiredMixin, CreateView):
      form_class = PlayerForm
      template_name = "project/player_add_view.html"
      model = Player
  
  def form_valid(self, form):
      player = form.save(commit=False)
  
      # I do other stuff here
      player.save()
  
      return HttpResponseRedirect(reverse('home'))
  </code></pre>