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

python 3.10 AttributeError: module 'collections' has no attribute 'Iterable' #64

Open bwakkie opened 2 years ago

bwakkie commented 2 years ago

Got an error when using python 3.10: I had to do the following change in order to have it back working in my project:

python3.10/site-packages/pure_pagination/paginator.py: replace the first line "import collections" into:

try: # Python 3.10
    from collections.abc import Iterable
except ImportError:
    from collections import Iterable

AND line 109 "elif isinstance(result, collections.Iterable):" into elif isinstance(result, Iterable):

ImMacy commented 2 years ago

I have some question. I can’t find : elif isinstance(result, Iterable):

please show your python3.10/site-packages/pure_pagination/paginator.py ?

thanks

naturezen commented 2 years ago

hi,I have a similar problem

python 3.10 Django 4.0.5

Error during template rendering In template ~\templates\pure_pagination\pagination.html, error at line 11

Invalid block tag on line 11: 'ifequal', expected 'elif','else' or 'endif'. Did you forget to register or load this tag?

10 {% if page %} 11 {% ifequal page page_obj.number %} 12

  • {{ page }}
  • bwakkie commented 2 years ago

    I have some question. I can’t find : elif isinstance(result, Iterable):

    please show your python3.10/site-packages/pure_pagination/paginator.py ?

    thanks

    Obviously you cant find it in the code as it needs to be changed into it. Read carefully ;-)