0👍
✅
The user is never in request.session
. It’s directly on the request object as request.user
.
1👍
Your view gets the request object so it has the “user” attribute, as such => request.user
if your problem is getting this user object while in the form you can override the save method of the form so it gets a user object and do whatever you need there with it.
def save(self, user):
# do something with user
and when calling the method:
form.save(request.user)
- [Answer]-QuerySet in Django – returns exception
- [Answer]-Show related model info in Django form
- [Answer]-Django filter field on the context processor
Source:stackexchange.com