i have a edit\_profile view at my django application that also checks if the pgp key the users saves to his profile is in RSA format, Anyways if i add a profile avatar for the very first time it works like a charm, if i want to clear or delete it, im always jumping onto the execpt block and the user avatar remains unchanged.
Well i dont see a clear reason why at the point can maybe smb give me a hint here:

validators.py

```
def default_image_file_extension(value):
    ext = os.path.splitext(value.name)[1]  # [0] returns path+filename
    valid_extensions = ['.jpg', '.jpeg', '.png']
    if not ext.lower() in valid_extensions:
        raise ValidationError(u'Unsupported extension. Allowed are are: .jpg, .jpeg, .png')

def default_image_size(value):
    limit = 2 * 1024 * 1024
    if value.size > limit:
        raise ValidationError('File too large. Size should not exceed 2 MiB/MB.')

```

models.py

```
def get_file_path(instance, filename):
    ext = filename.split('.')[-1]
    filename = "%s.%s" % (uuid.uuid4(), ext)
    return os.path.join('media', filename)

def get_file_path_user_avatar(instance, filename):
    ext = filename.split('.')[-1]
    filename = "%s.%s" % (uuid.uuid4(), ext)
    return os.path.join('user_avatar', filename)

...

    class User(AbstractBaseUser):
    user = models.CharField(verbose_name='Username', max_length=20, unique=True)
    bio = models.TextField(verbose_name='Bio', blank=True, null=True, max_length=2500)
    ...

```

forms.py

```
class UserForm(forms.ModelForm):

    class Meta:
        model = User
        fields = (
            'avatar',
            'bio',

        )
    captcha = CaptchaField()

    field_order = ['avatar', 'bio']

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.fields['avatar'].label = mark_safe('Avatar:')
        self.fields['avatar'].help_text = mark_safe("<h4 class='help_text'>→ Choose a Avatar for your Profile (max. 2 MB)</h4>")
        self.fields['bio'].widget.attrs.update({'class': 'class-two-input-fields'})
        self.fields['bio'].help_text = mark_safe("<h4 class='help_text'>→ Something about you</h4>")

```