def create_Post(request):
form = PostForm(request.POST or None)
if form.is_valid():
instance = form.save(commit=False)
instance.save()
return HttpResponseRedirect (instance.get_absolute_url())
context = {
"form": form,
}
return render(request, 'blog/create.html', context)
As shown in attached image, the user has to select themselves from list of users before they can submit their post.(which doesn't make sense). I want the form to know which user is writing the form(assuming they are logged in) so the user doesn't have to identify themselves before they submit their post. I'm guessing I need to edit my models.py but I have no idea. Please Help.
Thank you.