ok i solved the problem with a litlte javascript

i added the following line to my body-tag
<body onload="window.location.href += '#{{ anchor }}'">

the only thing i have todo is passing the anchor var to my template

  <snip>
  anchor-var = 'first-anchor' #set dynamicly somewhere in the code

  param = {
       'anchor' : 'anchor-var',
       'configs' : confs,
  }

  l = loader.get_template(template)
  c = Context(param)

  return HttpResponse(l.render(c))

thank you again...

best regards


On May 4, 10:40 am, babis <[EMAIL PROTECTED]> wrote:
> Thank you so mutch
>
> best regards
>
> On May 4, 10:30 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>
> > On Fri, 2007-05-04 at 01:22 -0700, babis wrote:
> > > so i have to use the HttpResponseRedirect() class, right?
>
> > Yes, that's correct.
>
> > > I am not very familiar with this class and its handling, can i pass it
> > > arguments like those i pass to an template?
>
> > All you pass to an HttpResponseRedirect() class is the URL to redirect
> > to. So your view would end with something like
>
> >         return HttpResponseRedirect(http://www.foo.com/blah#anchor')
>
> > > how can i use my template with redirects. Would you please so kind
> > > and send some code snippets
>
> > Here's what happens when you use an HTTP redirect like this (with
> > anchors):
>
> > (1) Your view returns the redirect command, as above.
>
> > (2) The browser sees that response and sends a request to the server 
> > forhttp://www.foo.com/blah. Because the browser handles the anchor, the
> > server is not sent that information (there are many cases where this is
> > annoying, but that's the way life works, so it's no use complaining
> > about it).
>
> > (3) Your Django code sees a request for the /blah/ URL and some view is
> > called to construct that information. The view returns a fully rendered
> > template, just like normal. Notice that your view doesn't care about the
> > anchor, which is lucky because it never sees the anchor. So you don't
> > need to do anything special in your view.
>
> > (4) The server receives the full HTML page, renders it and scrolls the
> > page so that the requested anchor is in the viewport.
>
> > Hopefully that will give you enough to do some experiments and fit it
> > into your code.
>
> > Note, also, that if you don't want to use a redirect like this, you can
> > scroll to the right location using Javascript (setting the location.hash
> > value). You can find lots of code fragments for doing that on the web.
>
> > Regards,
> > Malcolm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to