philipn/django-rest-framework-filters

ImportError: cannot import name 'QUERY_TERMS'

l25359423 opened this issue · 7 comments

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x105813b70>
Traceback (most recent call last):
  File "/Users/liuxiaoshuai/tmp/django/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/Users/liuxiaoshuai/tmp/django/django/core/management/commands/runserver.py", line 110, in inner_run
    autoreload.raise_last_exception()
  File "/Users/liuxiaoshuai/tmp/django/django/utils/autoreload.py", line 248, in raise_last_exception
    raise _exception[1]
  File "/Users/liuxiaoshuai/tmp/django/django/core/management/__init__.py", line 337, in execute
    autoreload.check_errors(django.setup)()
  File "/Users/liuxiaoshuai/tmp/django/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/Users/liuxiaoshuai/tmp/django/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/liuxiaoshuai/tmp/django/django/apps/registry.py", line 89, in populate
    app_config = AppConfig.create(entry)
  File "/Users/liuxiaoshuai/tmp/django/django/apps/config.py", line 90, in create
    module = import_module(entry)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rest_framework_filters/__init__.py", line 3, in <module>
    from .filterset import FilterSet
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rest_framework_filters/filterset.py", line 10, in <module>
    from django_filters import filterset, rest_framework
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django_filters/__init__.py", line 7, in <module>
    from .filterset import FilterSet
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django_filters/filterset.py", line 15, in <module>
    from .filters import (
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django_filters/filters.py", line 9, in <module>
    from django.db.models.sql.constants import QUERY_TERMS
ImportError: cannot import name 'QUERY_TERMS'

python3.6
django2.0.4

Hi @l25359423 - the version of django-filter that you're using does not support django 2.0. There is a 2.0.0.dev1 release that does support django 2.x, but note that it is a development release.

lcx94 commented

image
but still error

Hi @lcx94. The djangorestframework-filters v0.10.x is not compatible with Django 2.x and django-filter 2.x - you'll need to install the djangorestframework-filters 1.0 pre-release.

reopening as a reminder to update the readme with the version info.

Anything I can help with to make this Django 2.1 compatible?

I'm currently working on fixing CI. Some things have changed with Travis & tox. Once that's ready, it should be fairly straightforward to update compatibility.

Hi @iMerica. CI issues are fixed. The 1.0 pre-release is already compatible with Django 2.1