Proposal: Generic Pagination

2 views
Skip to first unread message

Iapain

unread,
Aug 27, 2007, 4:40:45 AM8/27/07
to Django developers
Introduction:

Most of the time ObjectionPaginator server incomplete functionality
because some one have to generate a page bar[<Prev 1 2 3 .. 10 11
12 .. 18 19 20 Next >] in template. However some a kind of template
tag would allow you to create a small tiny hack but not a generic one.
I just looked inside django.contrib.admin and I think it is fairly
possible and strongly believe Django should include it in its package.

Proposal:

To write a GenericPaginator class which should render page bar in
template if a template tag is encountered.

-It Should form querystring
-A decent Page bar
-Multiple Object support in a single template

Just open for your opinion, in case if it comes out to be useful then
I'll put a ticket on Trac.

Regards,
Deepak Thukral

Philipp Keller

unread,
Aug 27, 2007, 4:48:55 AM8/27/07
to django-d...@googlegroups.com
+1

I also looked into django.contrib.admin for that <Prev 1 2 3 .. 10 11 Next> thing and wanted to reuse the code there but ended in coding it myself.

greets
Philipp

oyvind....@gmail.com

unread,
Aug 27, 2007, 5:36:31 PM8/27/07
to Django developers

Paul Davis

unread,
Aug 27, 2007, 6:17:46 PM8/27/07
to django-d...@googlegroups.com

I extended a different snippet to do what I wanted. Posted it just now
at [1]. I do think that this needs to be looked at, for my first
django project, this was one of the major stumbling blocks for me.
(Which I think is about as good of an endorsement for django as any
other)

[1] http://www.djangosnippets.org/snippets/394/

Paul Davis

Iapain

unread,
Aug 27, 2007, 7:01:12 PM8/27/07
to Django developers
> http://www.djangosnippets.org/snippets/378/
Not really

> http://www.djangosnippets.org/snippets/394/
bit closer (should have used query string ?p=1 instead of /page/1)

But still I prefer the way django.contrib.admin is doing. The core
question is it should be included in django standard package? I
implemented one the way django.contrib.admin is doing. http://dpaste.com/17864/

Deepak

Paul Davis

unread,
Aug 27, 2007, 7:32:40 PM8/27/07
to django-d...@googlegroups.com
On 8/27/07, Iapain <iap...@gmail.com> wrote:
>
> > http://www.djangosnippets.org/snippets/378/
> Not really
>
> > http://www.djangosnippets.org/snippets/394/
> bit closer (should have used query string ?p=1 instead of /page/1)
>

I definitely wrestled with this. I ended up going without the query
string cause from the examples i saw it looked like the 'django way'
of doing things.

> But still I prefer the way django.contrib.admin is doing. The core
> question is it should be included in django standard package? I
> implemented one the way django.contrib.admin is doing. http://dpaste.com/17864/
>
> Deepak
>
>

And I vote yes to including a version similar to yours.

Paul Davis

Reply all
Reply to author
Forward
0 new messages