Reputation: 6787
When I post a comment with the django's comment framework, I have a hidden next
value set in hopes that once the comment is posted, it will bring the user to view their own comment. The next
field renders like this:
<input type="hidden" name="next" value="http://example.com/item/1#c23" />
However, when a comment is posted, django is adding a ?c=23
to the end of the url so the fully formed url that the user is redirected to becomes:
http://example.com/item/1#c23?c=23
In Firefox and Safari (brief testing) this prevents the page from moving down to the correct id=23
and just shows the very top of the page (I want it to show the just posted comment). Removing the ?c=23
fixes the problem (by hand) but I don't know how to tell Django to stop adding it.
Ideas?
Upvotes: 0
Views: 301
Reputation: 4208
Not a solution to your problem but just wanted to add that this is a bug in Django. It would be great if you could open a ticket for it.
For 1.1, it seems ticket 10585 took care of already existing query strings in the next
value. That is, if next
was http://example.com/item/1?a=1
then it became http://example.com/item/1?a=1?c=23
after a comment was posted. The code changes look pretty simple so you might even be able to provide a patch yourself.
Good luck!
Update February 27, 2011: Looks like ticket 13411 has a patch attached!
Upvotes: 1
Reputation: 16325
This jQuery line allows you to change the current URL:
$(this).attr("href", "NEW_URL");
Replace NEW_URL by the new URL. You can split http://example.com/item/1#c23?c=23 using the question mark and then use the first part of the array as the new URL.
Upvotes: 0