Reputation:
I'm kinda new to django and html and I wanted to know if its possible to scroll down a page to a div id by using a django view. (without using javascript)
In my html code I have something like:
<form type="POST" action="/submit_comment/">
...
</form>
Then in my urls I have:
url(r'^submit_message/$',page_views.Vep_submit_message),
And normally when a comment is submited, I process the form, and check for errors etc, then I render the previous page with the new information.
The problem is that it is a long page and I'd like to display the page scrolled to the comments div.
the comments div has an id, so normally by using /submit_message/#comments
or /submit_message#comments/
the window should get scrolled.
But it seems that django has some problems handling this:
You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data.
Is it possible to do something without javascript? Thanks!
Upvotes: 2
Views: 1526
Reputation:
I found a simple solution by adding the following meta
<meta http-equiv="refresh" content="0; url=#comments">
Upvotes: 1