Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import_by_path is deprecated in Django 1.10 #45

Open
sww314 opened this issue Sep 5, 2016 · 2 comments
Open

import_by_path is deprecated in Django 1.10 #45

sww314 opened this issue Sep 5, 2016 · 2 comments

Comments

@sww314
Copy link

sww314 commented Sep 5, 2016

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
Copy link

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
Copy link

baster33 commented Mar 3, 2017

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants