Q:

Struggling to use two forms with same function based view, connecting it to specific profiles

First off, I have a model named Account which ties into Django's native User model thorough a one to one field. I'm building an admin panel, where the goal is to be able to edit registered accounts (users) information through forms on their backend profile page.
I have managed to create a view using two forms (form for changing the user model and a form for changing the account model), but since the instance is request.user, I'm only able to edit my own information on the different profiles. I'm not sure how to tie the pk for account into the code.
The ultimate goal is for example:
http://path/to/user/profile/1 - Able to edit account 1's information
http://path/to/user/profile/2 - Able to edit account 2's information
I have tried to add pk to the definition of test, but without luck.
urls.py
urlpatterns = [
       path("test/<int:pk>", views.test, name="test"),
] 

views.py
def test(request, pk):

    if request.method == 'POST':
        u_form = UserEditPersonalForm(request.POST, instance=request.user)
        a_form = AccountEditPersonalForm(request.POST, instance=request.user.account)

        if u_form.is_valid() and a_form.is_valid():
            u_form.save()
            a_form.save()
            messages.success(request, f'Account updated')
            return redirect('/cms/test/')
    else:
        u_form = UserEditPersonalForm(instance=request.user)
        a_form = AccountEditPersonalForm(instance=request.user.account)

    context = {
        'u_form': u_form,
        'a_form': a_form
    }

    return render(request, 'cms/test.html', context)

A:

This doesn't have anything to do with "using two forms in the same function-based view". Please give your question a title that actually refers to your problem, which is that you want to edit the given user's details rather than the logged-in one.
The solution is simply to get the relevant user and pass it, rather than request.user and request.user.account, as the instance parameter to the forms:
def test(request, pk):
    user = User.objects.get(pk=pk)
    if request.method == 'POST':
        u_form = UserEditPersonalForm(request.POST, instance=user)
        a_form = AccountEditPersonalForm(request.POST, instance=user.account)

        if u_form.is_valid() and a_form.is_valid():
            ...
    else:
        u_form = UserEditPersonalForm(instance=user)
        a_form = AccountEditPersonalForm(instance=user.account)
    ...

