[Fixed]-'HttpResponse' object has no attribute 'get_absolute_url'


The error is on this line:

return redirect(comment.get_absolute_url())

It is telling you that comment is an HttpResponse, not a Comment instance. Therefore it doesn’t have a get_absolute_url() method.

Since comment is set on this line:

comment=post_comment_from_form(request, model, target, next=None,using=None)

You need to look at your post_comment_from_form method. If you are going to use the method in this view, it needs to return the comment, not an HttpResponse.

Leave a comment