If you're using Pagination
http://docs.djangoproject.com/en/dev/topics/pagination/ you can get the
previous and next pages like this:
{{ current_page.previous_page_number }}

If not, check it out. It's a simple way to manage pagination issues.

HTH,
Matias.

On Thu, Sep 3, 2009 at 8:25 PM, Tim Chase <django.us...@tim.thechases.com>wrote:

>
> > I am trying to output a variable page_no to a template, but I want to
> output
> > page_no + 1 and page_no - 1. How do I do that? I tried to do something
> like
> > {{ page_no + 1 }} and that failed. Tried {% and %} as well, but no
> success.
> >
> > Surely there is a way to do this other than having to calculate these
> values
> > in the view ahead of time?
>
> You bet -- you want the "add" filter:
>
>   {{ page_no|add:"1" }}
>
> detailed at
>
> http://docs.djangoproject.com/en/dev/ref/templates/builtins/#add
>
> -tim
>
>
>
>
>
> >
>


-- 
:wq

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to