title: (Django) Cannot upload images for the users avatar
body: <p>So I'm trying to make it possible for users to update their Avatar/Profile image by allowing them to upload their image + I want to implement an image cropper so they can crop the image to a ratio of 1 to 1. All tho I think the first thing is making it possible to upload.</p>
  
  <p>I've searched around trying to make it possible but I think I've almost been everywhere.</p>
  
  <p>The thing is the image field I'm using is like an extension to the User table I basically called it extendeduser that has all the extra information included in it.</p>
  
  <p>Media is set 2 i can upload files from the admin panel and they show normally.</p>
  
  <h3>Views.py</h3>
  
  <pre><code>@login_required
  def useravatar(request, user_pk):
      if request.method == 'POST':
          form = UpdateProfileForm(request.POST, request.FILES, instance=request.user)
          if form.is_valid():
              user = form.save()
              user.refresh_from_db()
              user.extendeduser.avatar = form.cleaned_data('avatar')
              user.save()
              messages.success(request, 'Your avatar was successfully Uploaded!')
              return redirect('useravatar', user_pk=request.user.pk)
      logged_in_user = get_object_or_404(User, pk=request.user.pk)
      requested_user = get_object_or_404(User, pk=user_pk)
      driverslicence = DriversLicenceCategories.objects.all()
      feedback = FeedbackSupportForm()
      password = PasswordChangeForm(request.user)
      avatar = UpdateProfileForm(instance=request.user)
      context = {
          'avatar'        : avatar,
          'logged_in_user': logged_in_user,
          'requested_user': requested_user,
          'feedback'      : feedback,
          'password'      : password,
      }
      return render(request, 'user/avatar.html', context)
  </code></pre>
  
  <h3>Models.py</h3>
  
  <pre><code>class ExtendedUser(models.Model):
      user = models.OneToOneField(User, on_delete=models.CASCADE)
      nickname = models.CharField(max_length=20)
      birthdate = models.DateField(null=True, blank=True)
      postal_code = models.CharField(max_length=10)
      phone_number_regex = RegexValidator(regex=r'^\+?1?\d{9,15}$', message="Phone number must be entered in the format: '+4570131415'. Up to 15 digits allowed.")
      phone_number = models.CharField(max_length=16, validators=[phone_number_regex], blank=True)
      phone_number_show = models.BooleanField(default=False)
      emergency_number = models.CharField(max_length=16, validators=[phone_number_regex], blank=True)
      drivers_licence = models.ManyToManyField(DriversLicenceCategories, blank=True)
      avatar = models.ImageField(upload_to='users/avatars', default='static/img/userpreload.png')
      background = models.ImageField(upload_to='users/backgrounds', default='static/img/userpreload.png')
  </code></pre>
  
  <h3>forms.py</h3>
  
  <pre><code>class UpdateProfileForm(forms.ModelForm):
      postal_code = forms.CharField(max_length=10, required=True)
      phone_number = forms.CharField(max_length=16, required=True)
      phone_number_show = forms.BooleanField(required=False)
      avatar = forms.ImageField()
      class Meta:
          model = User
          fields = ('username', 'first_name', 'last_name', 'email', 'postal_code', 'phone_number', 'phone_number_show', 'avatar')
  </code></pre>
  
  <h3>Then there is of course the html file with the form</h3>
  
  <pre><code>&lt;form action="" method="post" enctype="multipart/form-data"&gt;
                      {% csrf_token %}
                      &lt;div class="custompanel no-m-bottom"&gt;
                          &lt;h3&gt;Avatar&lt;/h3&gt;
                          &lt;hr style="border-color:rgba(0, 0, 0, 1);"&gt;
                          &lt;div class="form-group"&gt;
                              &lt;div class="setting-user-avatar"&gt;
                                  &lt;img class="user-avatar" src="{{ logged_in_user.extendeduser.avatar.url }}"&gt;
                              &lt;/div&gt;
                              &lt;label for="id_avatar"&gt;Change profile image.&lt;/label&gt;
                              &lt;input id="id_avatar" style="color: #000;" class="victext-input vic-block full-width" type="file" name="avatar"&gt;&lt;/input&gt;
                              &lt;small id="id_avatarHelpBlock" class="form-text text-muted"&gt;
                                   Current: &lt;a href="{{ logged_in_user.extendeduser.avatar.url }}"&gt;{{ logged_in_user.extendeduser.avatar.url }}&lt;/a&gt;
                              &lt;/small&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;button type="submit" class="vicbtn vicbtn-green w-100"&gt;Save&lt;/button&gt;
                  &lt;/form&gt;
  </code></pre>
  
  <p>I hope someone will help me get this to work because im basically totally broken</p>