Niklas Rosencrantz
Niklas Rosencrantz

Reputation: 26647

Evaluating django paginator with GAE

Is it a good idea to add the django paginator to our google app engine project to enable pagination? It looks tempting since I otherwise fail to implement pagination though there can be hidden disadvantages. For instance the PageQuery class that we tried yesterday couldn't page SearchableModel(!) but django paginator can. Is there a better reason to use cursors instead? Now I actually can page the dataset in a simple way using a page variable but I do it with the django paginator class

from paginator import Paginator, InvalidPage, EmptyPage

in this this case the following code actually pages the data set:

        articles = Articles.all()
        paginator = Paginator(articles,PAGESIZE)
        articles = paginator.page(page)

so I find this solution tempting since it's so easy and readable and hope that you can comment onwards. The django file I added is http://code.djangoproject.com/browser/django/trunk/django/core/paginator.py I can still use my IN query and the code is very readable just adding the django paginator. Am I making a mistake not using cursors and what are the disadvantages in my case? If you want closer look at my implementation details I've posted some here How to page the dataset Thank you

--

Upvotes: 0

Views: 206

Answers (1)

PanosJee
PanosJee

Reputation: 3866

A friend of mine uses it and has performance problems, I think it uses limit and offset which is not a great fit for AppEngine. The proper solution would be to use a paginator that uses cursors.

Upvotes: 2

Related Questions