jamespacileo / django-pure-pagination

Django pagination based upon the core pagination module
BSD 3-Clause "New" or "Revised" License
701 stars 171 forks source link

'int' object has no attribute 'encode' #51

Closed miaogen123 closed 6 years ago

miaogen123 commented 6 years ago

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.basequeryset.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

miaogen123 commented 6 years ago

把这一行中的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.

labixiaodong commented 5 years ago

你真牛逼