[Answered ]-Pass variable to a form

2👍

Well, you could refactor it into a function.

def save_with_user(form, user):
    obj = form.save(commit = False)
    obj.user = user
    obj.save()

# ...
form = EmploymentForm(data=request.POST or None, request=request)
save_with_user(form, profile)

0👍

No there isn’t, afaik. I know i’ll be getting a -1 for this answer.

Leave a comment