jamespacileo/django-pure-pagination

'int' object has no attribute 'encode'

miaogen123 opened this issue · 2 comments

when using this useful plugin, something happens:
Bellow are the messages from pycharm.
`
File "E:\work\python\FollowUpSystem_H5_new\web\views.py", line 439, in get
patient_set_paged = p.page(page)
File "E:\work\python\env\FollowUpSystem\lib\site-packages\pure_pagination\paginator.py", line 54, in page
return Page(self.object_list[bottom:top], number, self)
File "E:\work\python\env\FollowUpSystem\lib\site-packages\pure_pagination\paginator.py", line 129, in init
self.number = PageRepresentation(number, self.other_page_querystring(number))
File "E:\work\python\env\FollowUpSystem\lib\site-packages\pure_pagination\paginator.py", line 206, in other_page_querystring
return self.base_queryset.urlencode()
File "E:\work\python\env\FollowUpSystem\lib\site-packages\django\http\request.py", line 524, in urlencode
for v in list

File "E:\work\python\env\FollowUpSystem\lib\site-packages\django\http\request.py", line 524, in
for v in list

AttributeError: 'int' object has no attribute 'encode'

**my codes**
try:
page = request.GET.get('page', 1)
except PageNotAnInteger:
page = 1
p = Paginator(object_list=patient_set, per_page=10, request=request)
patient_set_paged = p.page(page)

        return render(request, "patient_list.html", {

`
i will be very happy if i can get your help

把这一行中的reques去掉就行了
p = Paginator(object_list=patient_set, per_page=10, request=request)
变成:
p = Paginator(object_list=patient_set, per_page=10)
the second line above works.

你真牛逼