django-admin-json-editor icon indicating copy to clipboard operation
django-admin-json-editor copied to clipboard

Issue with python 3.10

Open mattiagiupponi opened this issue 2 years ago • 1 comments

Hi, I'm using python 3.10 and the library raised this issue due to an incompatibility:

  File "/usr/local/lib/python3.10/dist-packages/django/forms/boundfield.py", line 34, in __str__
    return self.as_widget()
  File "/usr/local/lib/python3.10/dist-packages/django/forms/boundfield.py", line 93, in as_widget
    return widget.render(
  File "/usr/local/lib/python3.10/dist-packages/django_admin_json_editor/admin.py", line 24, in render
    self.schema_updater(schema)
  File "/usr/local/lib/python3.10/dist-packages/django_admin_json_editor/admin.py", line 41, in schema_updater
    if isinstance(value, collections.Mapping):
AttributeError: module 'collections' has no attribute 'Mapping'

This way of importing the module has been deprecated since python 3.3:

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' has been deprecated since Python 3.3, and in 3.10 it will stop working

It should be enough to change the import statement from import collection to from collections.abc import Mapping

mattiagiupponi avatar Jan 10 '23 09:01 mattiagiupponi