results_per_page does not work properly

0 views
Skip to first unread message

bradford

unread,
Mar 24, 2006, 11:58:54 PM3/24/06
to Django developers
I have added a few extra_lookup_kwargs to my generic object_list and
when in {{ results_per_page }} in my template it always displays what I
paginate_by. I'm using 0.91.

limodou

unread,
Mar 25, 2006, 12:16:02 AM3/25/06
to django-d...@googlegroups.com

what do you want. I'v checked the source code about object_list, and
the docstring says that:

results_per_page
number of objects per page (if paginated)

So results_per_page is a integer but not a object list.

--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit

bradford

unread,
Mar 25, 2006, 12:52:05 AM3/25/06
to Django developers
i want the number of objects returned for that particular page. i
guess what i want is results_on_page. when i go to page 2 (of my
results), which only has 1 object listed it says that results_per_page
is 2, i would like it to say 1. what would be even better is if there
was a displaying_results_from and displaying_results_to.

limodou

unread,
Mar 25, 2006, 1:31:40 AM3/25/06
to django-d...@googlegroups.com
On 3/25/06, bradford <finge...@gmail.com> wrote:
>

There seems no such attribute existed in list_detail, but I think you
can count the number of the object_list, if you are using template, I
think you can do:

{{ object_list|length }}

to get the exactly number of the objects on the page.

bradford

unread,
Mar 25, 2006, 1:38:40 AM3/25/06
to Django developers
thanks. that seemed to do the trick.

it would be nice to see the
displaying_results_from/displaying_result_to feature implemented.

limodou

unread,
Mar 25, 2006, 2:39:40 AM3/25/06
to django-d...@googlegroups.com
On 3/25/06, bradford <finge...@gmail.com> wrote:
>

I think you can write your own pagination process. I create one for me
according to the core/paginator.py.

Reply all
Reply to author
Forward
0 new messages