[Fixed]-Form submission not generating new Post object

1👍

You can’t pass the user as the instance parameter to a Post form. You should omit that argument and assign the user on the actual Post instance returned from save.

form = Post_form(data=request.POST)
if form.is_valid():
    post = form.save(commit=False)
    post.user = request.user
    post.save()

Leave a comment