I have two models – UserProfile and Address. UserProfile has a foreign key to Address. I have a form for both models using a ModelForm each with a prefix, ‘profile’ and ‘account’ respectively. My view code is as follows:
def UpdateProfileView(request):
if request.method == 'POST':
    
    profile_form = UserProfileUpdateForm(request.POST, prefix='profile')
    address_form = AddressForm(request.POST, prefix='address')
    
    
    if all(profile_form.is_valid(), address_form.is_valid):
        profile_form.save()
        address_form.save()
        messages.success(request, "Your profile has been updated")
        context = {
            "profile_form" : profile_form,
            "address_form" : address_form
        }
        return render(request, "registration/update.html", context)
else:
    profile_form = UserProfileUpdateForm(prefix='profile')
    address_form = AddressForm(prefix='address')    
    context = {
        "profile_form" : profile_form,
        "address_form" : address_form
        }
    return render(request, "registration/update.html", context)
how can i do this? i know i need to somehow access the user instance but can’t figure it out.