Look at "next" and "previous" context variables. You can do:

<a href="/url/page{{ next }}">Next</a>

and

<a href="/url/page{{ previous }}">Previous</a>

to get what you want, as long as you've set up the URL regexes  
properly in urls.py. You'll want to surround each of the above with  
an if block to check and see if you do, indeed, have a next or  
previous page ("has_next" and "has_previous").

-Tyson

On Jun 21, 2007, at 1:11 PM, Rob Hudson wrote:

>
> I've set up a list view that I want paginated and I'm using the
> list_detail generic view.  I was thinking that I would prefer the / 
> url/
> page2/ URL over /url?page=2 so I set that up.  The problem is, in my
> template where I want to display the prev/next links there's no way
> that I see to avoid hard coding the "url" part of the path to the next
> and prev pages.
>
> With this in mind, it seems like the ?page=2 option is preferred.
>
> Is this right?  What are the pros/cons of one over the other?  *Is*
> there a way to get the URL prefix up to the /page2/ part?
>
> Thanks,
> Rob

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