On Wed, 30 Apr 2008 17:48:54 -0700 (PDT)
Jay <[EMAIL PROTECTED]> wrote:

> 
> Thank you-- I meant to include that.  The template tag is here,
> unchanged:
> 
> http://www.djangosnippets.org/snippets/673/
> 
> On Apr 30, 8:41 pm, Lucas Hazel <[EMAIL PROTECTED]> wrote:
> > On Wed, 30 Apr 2008 17:21:47 -0700 (PDT)
> >
> >
> >
> > Jay <[EMAIL PROTECTED]> wrote:
> >
> > > Hi, guys.  I'm working with a paginator templatetag, and I'm
> > > trying to apply a custom style to the current page.
> >
> > > In the code below, page.number renders *outside* the forloop, but
> > > not *inside* the forloop.
> >
> > > {{ page.number }} << this one renders, but the next page.number
> > > does not.
> > > {% for page in page.object_list %}
> > > <span class="{% ifequal page.number forloop.counter %}current{%
> > > else %}page{% endifequal %}">
> > > {{ forloop.counter }}
> > > </span>
> > > {% endfor %}
> >
> > > How can I get that page.number inside the loop?
> >
> > It's a bit hard to tell what's going on without the template tag,
> > but it appears you have a name collision.
> >

You're redefining the page variable in your template. The paginate tag
by default will set a variable called 'page' in your context.

Either rename the paginator object using 'as' in your tag or use a
different name in your for loop.

-- 
Lucas Hazel <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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