Hi @Radu,
Great article but I just want to point out a few issues. The first is in your BlogPostDetailView
BlogPostDetailView
def get_context_data(self, **kwargs): data = super().get_context_data(**kwargs) comments_connected = BlogComment.objects.filter( blogpost_connected=self.get_object()).order_by('-date_posted')
This is bound to throw a Type Error. In this case, it will be an object not callable error.
Type Error
object not callable
The other issue I see arising is with the post:
def post(self, request, *args, **kwargs): new_comment = BlogComment(content=request.POST.get('content'), author=self.request.user, blogpost_connected=self.get_object())
The blogpost_connected should be an instance of the BlogPost and not the BlogComment. I hope this is helpful. Best regards.
blogpost_connected
BlogPost
BlogComment
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi @Radu,
Great article but I just want to point out a few issues. The first is in your
BlogPostDetailView
This is bound to throw a
Type Error
. In this case, it will be anobject not callable
error.The other issue I see arising is with the post:
The
blogpost_connected
should be an instance of theBlogPost
and not theBlogComment
. I hope this is helpful. Best regards.