changed file upload is not getting saved

I have uploaded a file earlier.
when I want to change that using new file, the new file is not getting saved.
please, help.

Here the code in view.py

def profile2(request):
    # if this is a POST request we need to process the form data
    
        # create a class instance and populate it with data from the request:
    if request.method == 'POST' and 'id_document' in request.FILES:
        form = ProfileForm(request.POST,request.FILES)
        if form.is_valid():
            cd = form.cleaned_data
            pf = profile(
                uname = request.user,
                first_name = cd['first_name'],
                last_name = cd['last_name'],
                birth_date = cd['birth_date'],
                Country = cd['Country'],
                eMail= cd['eMail'],
                id_document = cd['id_document'],
                
                
            )
            pf.registration = False
            pf.save()

     
        return HttpResponseRedirect(reverse('index'))

Here is forms.py

class ProfileForm(ModelForm):
    class Meta:
        model = profile
        fields = ['first_name', 'last_name', 'birth_date', 'Country', 'eMail','id_document']
        widgets = {
            'birth_date': DateInput(attrs={'type': 'date'})
        }

This appears to be creating a new instance of profile. I believe you would want to look up if the user has an existing profile first. Update if it exists otherwise create a new one. You could supply the instance to the form or you could do it directly like you are with update_or_create

Thank you.
I changed the code. However, it is still not ‘saving’ the changes.

if request.method == 'POST' and 'id_document' in request.FILES:
        form = ProfileForm(request.POST,request.FILES)
        if form.is_valid():
            cd = form.cleaned_data
            pf = profile.objects.update_or_create(
                uname = request.user,
                first_name = cd['first_name'],
                last_name = cd['last_name'],
                birth_date = cd['birth_date'],
                Country = cd['Country'],
                eMail= cd['eMail'],
                id_document = cd['id_document'],
                
                
            )
            pf.registration = False
            pf.save()

     
        return HttpResponseRedirect(reverse('index'))

I think you may not understand update_or_create well enough. You should be supplying the defaults argument where most of the values would be set. Any other keyword argument should be the fields that will generate a unique instance. In your case, I believe it should be the user reference, uname.

Are you sure the form is returning True for form.is_valid()? It looks like regardless of that call, a redirect response is returned.

Thanks again for answer.
form.is_valid() is ‘False’. I am not sure what is happening here.