Correct redirect after posting comment - django comments framework
Posted
by
Sachin
on Stack Overflow
See other posts from Stack Overflow
or by Sachin
Published on 2012-07-02T21:12:51Z
Indexed on
2012/07/02
21:15 UTC
Read the original article
Hit count: 268
I am using django comments framework for allowing users to comment on my site, but there is a problem with the url to which user is redirected after posting the comment. If I render my comment form as
{% with comment.content_object.get_absolute_url as next %}
{% render_comment_form for comment.content_object %}
{% endwith %}
Then the url to which it is redirected after the comment is posted is
<comment.content_object.get_absolute_url/?c=<comment.id>
For example I posted a comment on a post with url /post/256/a-new-post/
then the url to which I am redirected after posting the comment is /post/256/a-new-post/?c=99
where assume 99 is the id comment just posted. Instead what I want is something like this /post/256/a-new-post/#c99
.
Secondly when I do comment.get_absolute_url() I do not get the proper url instead I get a url like /comments/cr/58/14/#c99
and this link is broken. How can I get the correct url as mentioned in the documentation. Am i doing something wrong.
Any help is appreciated.
© Stack Overflow or respective owner