Tuesday, February 28, 2012

Re: Can't get pagination to work in django.!!!

On Tue, Feb 28, 2012 at 2:45 PM, Tony Kyriakides
<tonykyriakidis@gmail.com> wrote:
> I get this error:
>
> Template error
>
> In template /home/tony/Documents/vidupdate/templates/index.html, error
> at line 24
>
> Caught TypeError while rendering: 'Page' object is not iterable
> 14      {% else %}
> 15      <li><a href="/register" >Register</a></li>
> 16      <li><a href="/login">Login</a></li>
> 17      {% endif %}
> 18      <li><a href="/feedback">feedback</a></li>
> 19      <li><a href="/contact" >Contact</a></li>
> 20      </ul>
> 21      <br />
> 22      <h2>Entries</h2>
> 23      <ul>
> 24      {% for entry in entries %}
> 25      <li><a href="{{ entry.link }}" >{{ entry.title }}</a>
> {{ entry.posted }} {{ entry.submitter }}</li>
> 26      {% endfor %}

https://docs.djangoproject.com/en/1.3/topics/pagination/#using-paginator-in-a-view

Compare and contrast what you are doing with 'entries' in that for
loop and what the docs do with the equivalent object in the linked
example, 'contacts'.

Your pagination links are referring to 'contacts' rather than
'entries' - copy/paste error there?

Cheers

Tom

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

No comments:

Post a Comment