[Fixed]-When doing a POST request on a model from a form it doesn't assign an ID to the object

1👍

You are using same primary key for accessing Report and the User:

report = FishingReport.objects.get(id=pk)
comments = Comment.objects.filter(parent_report=pk)
user = User.objects.get(id=pk)

In the URL, pk=5 seems to be the ID of the report you have created and not of the User you are trying to access. And, looking at the stacktrace it seems that there is no user with id 5 in the database.

👤AKS

Leave a comment