We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f2ddaba commit bf11befCopy full SHA for bf11bef
django_babel/extract.py
@@ -1,5 +1,14 @@
1
# -*- coding: utf-8 -*-
2
-from django.template.base import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK
+try:
3
+ # Django >= 2.1
4
+ from django.template.base import Lexer, TokenType
5
+ TOKEN_TEXT = TokenType.TEXT
6
+ TOKEN_VAR = TokenType.VAR
7
+ TOKEN_BLOCK = TokenType.BLOCK
8
+except ImportError:
9
+ # Django < 2.1
10
+ from django.template.base import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK
11
+
12
from django.utils.translation import trim_whitespace
13
from django.utils.encoding import smart_text
14
0 commit comments