2👍
Maybe you want something like this
def post_create(request):
form = ModelForm (request.POST or None, request.FILES or None)
user = User.objects.get(username=request.user.username)
if form.is_valid():
instance = form.save(commit=False)
instance.asker= user
instance.save()
context = {
"form": form
}
return render (request,"blog/create.html",context)
Source:stackexchange.com