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 edf593cCopy full SHA for edf593c
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
+ from django.template.base import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK
4
+except ImportError:
5
+ # Django 2.1+
6
+ from django.template.base import Lexer, TokenType
7
+
8
+ TOKEN_TEXT = TokenType.TEXT
9
+ TOKEN_VAR = TokenType.VAR
10
+ TOKEN_BLOCK = TokenType.BLOCK
11
12
from django.utils.translation import trim_whitespace
13
from django.utils.encoding import smart_text
14
0 commit comments