Re: Difficulty using anchor tags in templates

2009-11-29 Thread Andy
Fantastic!  I think I was overthinking my problem.  Thanks a lot!

On Nov 29, 10:36 am, rebus_  wrote:
> BTW here is an example:
>
> When you click this 
> link:http://en.wikipedia.org/wiki/Fragment_identifier#Processing
>
> your browser will open uphttp://en.wikipedia.org/wiki/Fragment_identifierpage 
> and then scroll
> down to the Processing title without wikipedia even knowing that you
> specifically want to see that part of the page, it will just send you
> the page and let your browser worry about scrolling.
>
> Also i apologize, since English is not my native language i might have
> trouble explaining some thing with it :)
>
> Davor

--

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: Difficulty using anchor tags in templates

2009-11-29 Thread rebus_
BTW here is an example:

When you click this link:
http://en.wikipedia.org/wiki/Fragment_identifier#Processing

your browser will open up
http://en.wikipedia.org/wiki/Fragment_identifier page and then scroll
down to the Processing title without wikipedia even knowing that you
specifically want to see that part of the page, it will just send you
the page and let your browser worry about scrolling.

Also i apologize, since English is not my native language i might have
trouble explaining some thing with it :)

Davor

--

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: Difficulty using anchor tags in templates

2009-11-29 Thread rebus_
I have seem to overcomplicated and I hope i understand your question right :)

You just need to render the template with your titles and content (i
guess you call it resources).

If you have a link such as link anywhere
on your site, once you click on it you should return HttpResponse and
render your template with titles and content normally.

You don't need HttpResponseRedirect in resources view and you don't
need to do any special handling of fragment id in Django. It is done
by your client (browser).

so instead of

def resources(request):
   return HttpResponseRedirect('/resources/')

you would have something like:

def resources(request):
  articles = Context({'articles': Articles.objects.all()})
  return render_to_response('resources.html', articles)

If anywhere in your resources.html (once it's rendered) there is a
title or any other element which has id="title" your browser will
position that page on that element.

I suggest you read more on fragment identifiers.

http://en.wikipedia.org/wiki/Fragment_identifier

Davor

--

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: Difficulty using anchor tags in templates

2009-11-29 Thread Andy
Hmm, still not clear.  My url is simply this:
(r'^resources/$', views.resources)

I have read that I need to use HttpResponseRedirect to make use of
#anchor tags.  Is this not the case?

Thanks for your help!


On Nov 29, 8:38 am, rebus_  wrote:
> 2009/11/29 Andy :
>
>
>
>
>
> > I have a model named Articles with title and content fields.  Each
> > page of my site should display a list of the titles, linked with
> > anchor tags to the corresponding area of the Resources page which
> > displays all the titles and content.  I am having trouble figuring out
> > how to pass the #title info.  I've read a previous post:http://
> > groups.google.com/group/django-users/browse_thread/thread/
> > bf5bae5b333aae/b8627d237d34fd69?lnk=gst=anchor+tag#b8627d237d34fd69,
> > but am still struggling.
>
> > Views(snippet):
> > articles = Context({'articles': Articles.objects.all()})
> > def index(request):
> >        return render_to_response('index.html', articles)
> > def resources(request):
> >        return HttpResponseRedirect('/resources/')
>
> > Base Template(snippet):
> >        
> >                Resources
> >                
> >                {% for articles in articles %}
> >                 > target="_blank">
> > {{ articles }}
> >        {% endfor %}
> >                
> >        
>
> > I am getting a 'too many redirect' error with this code.  Can anybody
> > help me with this?
>
> With assumption you have set your url like:
>
> url(r'^resources/$', 'resources',  name='resources')
>
> each time you open "resources" view you would get redirected to the
> "resources" view and you have endless loop, which browsers would
> terminate after certain number of repetitions.
>
> resources view should return html page with titles and content rather
> then redirect to it self.
>
> Basically, when you click on "/some/page/#fid", view which handles
> /some/page/ url should return HTML page, and if there is a fragment id
> ("#fid" in this case) in that page your browser should position your
> page on that fragment id (if possible).
>
> Hope i didn't overcomplicated this :)
>
> Davor

--

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: Difficulty using anchor tags in templates

2009-11-29 Thread rebus_
2009/11/29 Andy :
> I have a model named Articles with title and content fields.  Each
> page of my site should display a list of the titles, linked with
> anchor tags to the corresponding area of the Resources page which
> displays all the titles and content.  I am having trouble figuring out
> how to pass the #title info.  I've read a previous post:http://
> groups.google.com/group/django-users/browse_thread/thread/
> bf5bae5b333aae/b8627d237d34fd69?lnk=gst=anchor+tag#b8627d237d34fd69,
> but am still struggling.
>
> Views(snippet):
> articles = Context({'articles': Articles.objects.all()})
> def index(request):
>        return render_to_response('index.html', articles)
> def resources(request):
>        return HttpResponseRedirect('/resources/')
>
> Base Template(snippet):
>        
>                Resources
>                
>                {% for articles in articles %}
>                
> {{ articles }}
>        {% endfor %}
>                
>        
>
> I am getting a 'too many redirect' error with this code.  Can anybody
> help me with this?
>

With assumption you have set your url like:

url(r'^resources/$', 'resources',  name='resources')

each time you open "resources" view you would get redirected to the
"resources" view and you have endless loop, which browsers would
terminate after certain number of repetitions.

resources view should return html page with titles and content rather
then redirect to it self.

Basically, when you click on "/some/page/#fid", view which handles
/some/page/ url should return HTML page, and if there is a fragment id
("#fid" in this case) in that page your browser should position your
page on that fragment id (if possible).

Hope i didn't overcomplicated this :)

Davor

--

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.




Difficulty using anchor tags in templates

2009-11-29 Thread Andy
I have a model named Articles with title and content fields.  Each
page of my site should display a list of the titles, linked with
anchor tags to the corresponding area of the Resources page which
displays all the titles and content.  I am having trouble figuring out
how to pass the #title info.  I've read a previous post:http://
groups.google.com/group/django-users/browse_thread/thread/
bf5bae5b333aae/b8627d237d34fd69?lnk=gst=anchor+tag#b8627d237d34fd69,
but am still struggling.

Views(snippet):
articles = Context({'articles': Articles.objects.all()})
def index(request):
return render_to_response('index.html', articles)
def resources(request):
return HttpResponseRedirect('/resources/')

Base Template(snippet):

Resources

{% for articles in articles %}

{{ articles }}
{% endfor %}



I am getting a 'too many redirect' error with this code.  Can anybody
help me with this?

--

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.