Re: How to get rid of anchor in url when rendering via render_to_response()
Ah, right. I had actually forgotten that the action attribute was what was setting my url! What you said makes perfect sense, thanks! Margie On Dec 1, 12:50 pm, Bill Freemanwrote: > Filter it off when you create the form action? Or in more detail, > probably, in your view > function, create a copy of the url with such stuff removed, easy to do > with python > string manipulations, or maybe just use reverse on the view function > itself, and pass > that as, say, form_action, and in your template use: > > > On Tue, Dec 1, 2009 at 3:38 PM, Margie Roginski > > wrote: > > I have a scenario where I have redirected the user to a particular > > url, something like: > > >http://www.example.com/taskmanager/edit_task/5#comment_4 > > > In other words, they are viewing a particular comment associated with > > task 5. This comment is say a page or two down (ie, scrolled down) > > from the top of the page where there are fields associated with task > > 5. > > > Now the user scrolls up to the top of the page, which puts them as if > > they were viewing task 5 from its main url, ie > > >http://www.example.com/taskamanger/edit_task/5 > > > They make some change to the task - say change the due date. But they > > make an error which is caught on the server side. When my server code > > runs, it calls render_to_response to re-render the page to display the > > error. Howevever, because their original url was > > >http://www.example.com/taskmanager/edit_task/5#comment_4 > > > they are now taken back to the page with comment_4 in their view, > > rather than to the top of the page where their error is. > > > Is there a way for me to get rid of the #comment_4 anchor in the url, > > so that they are taken back to the top of the page when > > render_to_response() is called? > > > Thanks, > > > Margie > > > -- > > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to get rid of anchor in url when rendering via render_to_response()
Filter it off when you create the form action? Or in more detail, probably, in your view function, create a copy of the url with such stuff removed, easy to do with python string manipulations, or maybe just use reverse on the view function itself, and pass that as, say, form_action, and in your template use: wrote: > I have a scenario where I have redirected the user to a particular > url, something like: > > http://www.example.com/taskmanager/edit_task/5#comment_4 > > In other words, they are viewing a particular comment associated with > task 5. This comment is say a page or two down (ie, scrolled down) > from the top of the page where there are fields associated with task > 5. > > Now the user scrolls up to the top of the page, which puts them as if > they were viewing task 5 from its main url, ie > > http://www.example.com/taskamanger/edit_task/5 > > They make some change to the task - say change the due date. But they > make an error which is caught on the server side. When my server code > runs, it calls render_to_response to re-render the page to display the > error. Howevever, because their original url was > > http://www.example.com/taskmanager/edit_task/5#comment_4 > > they are now taken back to the page with comment_4 in their view, > rather than to the top of the page where their error is. > > Is there a way for me to get rid of the #comment_4 anchor in the url, > so that they are taken back to the top of the page when > render_to_response() is called? > > Thanks, > > Margie > > -- > > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
How to get rid of anchor in url when rendering via render_to_response()
I have a scenario where I have redirected the user to a particular url, something like: http://www.example.com/taskmanager/edit_task/5#comment_4 In other words, they are viewing a particular comment associated with task 5. This comment is say a page or two down (ie, scrolled down) from the top of the page where there are fields associated with task 5. Now the user scrolls up to the top of the page, which puts them as if they were viewing task 5 from its main url, ie http://www.example.com/taskamanger/edit_task/5 They make some change to the task - say change the due date. But they make an error which is caught on the server side. When my server code runs, it calls render_to_response to re-render the page to display the error. Howevever, because their original url was http://www.example.com/taskmanager/edit_task/5#comment_4 they are now taken back to the page with comment_4 in their view, rather than to the top of the page where their error is. Is there a way for me to get rid of the #comment_4 anchor in the url, so that they are taken back to the top of the page when render_to_response() is called? Thanks, Margie -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.