1
我试图让一些分页GAE python,但我甚至无法获得教程(https://docs.djangoproject.com/en/dev/topics/pagination /)工作。我在这里看到了相互冲突的答案。这里是我使用的代码:分页和显示与Django模板行记录
class EditCompanyHandler(webapp.RequestHandler):
# https://docs.djangoproject.com/en/dev/topics/pagination/
def get(self):
company_list = Company.all()
paginator = Paginator(company_list, 25)
You are using the default Django version (0.96). The default Django version will change in an App Engine release in the near future. Please call use_library() to explicitly select a Django version. For more information see https://developers.google.com/appengine/docs/python/tools/libraries#Django
E 2012-05-25 06:31:36.341
<type 'exceptions.ImportError'>: cannot import name Paginator
Traceback (most recent call last):
File "/base/data/home/apps/s~XX/1.359153909296057586/showcompanies.py", line 24, in <module>
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
I 2012-05-25 06:31:36.343
This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application.
我正在寻找一种直接的方式来分页。
如果我更新djnago版本1.1,我得到如下:
<type 'exceptions.ImportError'>: cannot import name Paginator
Traceback (most recent call last):
File "/base/data/home/apps/s~biomapit/1.359154059826228765/showcompanies.py", line 25, in <module>
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
'def get(self)...'是你使用的所有代码?没有进口? –
@reos,不,这只是一个剪辑 – Androidian
尝试扩展'EditCompanyHandler'类Paginator太多,就像这个'类EditCompanyHandler(webapp.RequestHandler,Paginator):' –