In python3.6 and Django2.1 error
Opened this issue · 4 comments
istarmeow commented
File "xxx\views.py", line 25, in get
all_article = p.page(page)
AttributeError: 'int' object has no attribute 'encode'
try:
page = request.GET.get('page', 1)
except PageNotAnInteger:
page = 1
p = Paginator(all_article, per_page=5, request=request) # 每页显示5条
all_article = p.page(page)
istarmeow commented
p = Paginator(all_article, 8)
lucasmoeskops commented
This needs to be fixed. It will only work when no request parameter is given to the Paginator, but this will produce incorrect page querystring urls, since the Paginator doesn't know about the querystring.
lucasmoeskops commented