Skip to content

Commit

Permalink
Fix imports of token types for Django 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tsouvarev authored and joehybird committed Apr 15, 2019
1 parent f2ddaba commit 404a8f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion django_babel/extract.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -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 =
Expand All @@ -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}

Expand Down

0 comments on commit 404a8f9

Please sign in to comment.