django-pagination icon indicating copy to clipboard operation
django-pagination copied to clipboard

Django 1.7, 1.8 and Python 3.x compatibility

Open krallin opened this issue 11 years ago • 0 comments

Hi there,

This PR is more there to highlight an issue than to propose an actual fix, but:

  • In Django 1.7, the paginator class no longer uses a range, but uses an "xrange" instead (on Python 2. On Python 3 xrange has become range).
  • On Python 2, xranges aren't sliceable, so attempting to slice what we got returns in an error.

https://github.com/ericflo/django-pagination/blob/master/pagination/templatetags/pagination_tags.py#L144

I suppose an actual fix should actually check for Python 2: there's no use coercing the range to a list on Python 3 as a Python 3 range can be sliced.

krallin avatar Jul 31 '14 20:07 krallin