I’m trying to save data linked to a user profile using a model with User as a foreign key. I can’t figure out a way to create a form that allows adding new instances of the data without having the user name in the form itself. I want to have a form that excludes the user foreign key. Everything works fine until I try to add the user id to the form/data that is about to be saved.
How can I take the logged in user, passed back and forth in the request object, and inject it into the data before I save it?
Use a form constructor to give initial values to the form, so like
you can read more at django docs