djangonauts / django-pgjson

PostgreSQL json field support for Django
http://djangonauts.github.io/django-pgjson/
Other
131 stars 38 forks source link

import_by_path is deprecated in Django 1.10 #45

Open sww314 opened 8 years ago

sww314 commented 8 years ago

In Django 1.10+ import_by_path is removed.

from django_pgjson.fields import JsonField Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.7/site-packages/django_pgjson/fields.py", line 21, in from django.utils.module_loading import import_by_path as import_string ImportError: cannot import name import_by_path

carldunham commented 8 years ago

So this is actually because of bug in the way that Django versions are detected:

if django.get_version() >= "1.7":
    from django.utils.module_loading import import_string
else:
    from django.utils.module_loading import import_by_path as import_string

This fails for Django >= 1.10 because of the lexical compare.

baster33 commented 7 years ago

And there is further problem with models.SubfieldBase which is removed in 1.10:

class JsonField(six.with_metaclass(models.SubfieldBase, models.Field)):
AttributeError: 'module' object has no attribute 'SubfieldBase'