Hello,

I've just started looking at Django, it's certainly looking like a very
good choice for the sort of projects I'll be doing in the near future.


Just now I've been looking at pagination and have a question:

I'm using the generic view "list_detail" to view a list of results.  I
want to use pagination to restrict the number of items on a page.  To
do this I've added a "paginate_by" value to the info_dict dictionary in
my urls.py file.  This results in my results being paginated correctly,
and the additional context parameters are available in my template.  I
can use these to show how many hits there were and how many pages of
results etc there are.  My problem comes with trying to show a numbered
link to each page of results (like google does at the bottom of its
results page).  I thought this would be straightforward - just do a
loop - but as far as I can see the {% for %} tag can only iterate over
an array, and the "pages" context property is a number.  What is the
right way to go about looping from N to N+M in a template ?  My feeling
is that looping over a list is the nicest way, but then I can't get the
pagination to work like I want!  Apologies if I'm missing something
really obvious!

In the course of trying to figure this out I tinkered around with the
list_detail.py file and tried adding extra context parameters (e.g.
'page_list':range(1, pages+1, 1) ).  These never showed up in my
templates though - are there specific steps to take in order to make
changes to the django source files be noticed by the server (I'm using
the test server that comes with Django)?

Thanks in advance for any help,

Stephen.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to