diff --git a/django_babel/extract.py b/django_babel/extract.py index edb42c7..e664a16 100644 --- a/django_babel/extract.py +++ b/django_babel/extract.py @@ -1,5 +1,14 @@ # -*- coding: utf-8 -*- -from django.template.base import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK +try: + from django.template.base import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK +except ImportError: + # Django 2.1+ + from django.template.base import Lexer, TokenType + + TOKEN_TEXT = TokenType.TEXT + TOKEN_VAR = TokenType.VAR + TOKEN_BLOCK = TokenType.BLOCK + from django.utils.translation import trim_whitespace from django.utils.encoding import smart_text diff --git a/tox.ini b/tox.ini index e763d02..1fe3de5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{35,36}-djangomaster, py{27,34,35,36}-django{18,111,20}, lint, docs +envlist = py{35,36,37}-django{21,master}, py{27,34,35,36}-django{18,111,20}, lint, docs [testenv] deps = @@ -11,6 +11,7 @@ deps = django18: Django>=1.8,<1.9 django111: Django>=1.11,<2.0 django20: Django>=2.0,<2.1 + django21: Django>=2.1,<2.2 djangomaster: https://github.com/django/django/archive/master.tar.gz#egg=Django commands = py.test {posargs}