Django 1.11 upgrade to Django 2.x
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 "E:\py_virtualenv\joyoo\lib\site-packages\django_filters\__init__.py", line 4, in <module>
from .filterset import FilterSet
File "E:\py_virtualenv\joyoo\lib\site-packages\django_filters\filterset.py", line 16, in <module>
from .filters import (Filter, CharFilter, BooleanFilter, BaseInFilter, BaseRangeFilter,
File "E:\py_virtualenv\joyoo\lib\site-packages\django_filters\filters.py", line 11, in <module>
from django.db.models.sql.constants import QUERY_TERMS
ImportError: cannot import name 'QUERY_TERMS'
source code location:..\Lib\site-packages\django_filters\filters.py
try:
# djagno 1.11
from django.db.models.sql.constants import QUERY_TERMS
except ImportError:
# Django 2.1
QUERY_TERMS = {
'exact', 'iexact', 'contains', 'icontains', 'gt', 'gte', 'lt', 'lte', 'in',
'startswith', 'istartswith', 'endswith', 'iendswith', 'range', 'year',
'month', 'day', 'week_day', 'hour', 'minute', 'second', 'isnull', 'search',
'regex', 'iregex',
}