File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -259,15 +259,24 @@ def render(self, context):
259259 # it back in place before returning from render.
260260 # https://docs.djangoproject.com/en/1.11/howto/custom-template-tags/#thread-safety-considerations # noqa
261261 old_source_string_var = self .source_string .var
262+ try :
263+ old_is_var = self .source_string .is_var
264+ except AttributeError :
265+ old_is_var = None
262266
263267 # Now we resolve the full source filter expression, after having
264268 # replaced its text with the outcome of the translation, in order to
265269 # apply the expression's filters to the translation. The translation is
266270 # marked as safe in order to prevent further escaping attempts that
267271 # would introduce the danger of double escaping (eg `<` => `&lt;`)
268272 self .source_string .var = mark_safe (result )
273+ self .source_string .is_var = False
274+
269275 result = self .source_string .resolve (context )
276+
270277 self .source_string .var = old_source_string_var
278+ if old_is_var is not None :
279+ self .source_string .is_var = old_is_var
271280
272281 if self .asvar is not None :
273282 # Save the translation outcome to a context variable
Original file line number Diff line number Diff line change @@ -58,7 +58,8 @@ def _get_ordered_tokens(parser):
5858 This method is useful when we want to iterate all the remaining
5959 tokens of the parser in the correct order.
6060 """
61- if DJANGO_VERSION [0 ] >= 3 and DJANGO_VERSION [1 ] > 1 :
61+ major , minor = DJANGO_VERSION [:2 ]
62+ if major == 3 and minor > 1 or major > 3 :
6263 return reversed (parser .tokens )
6364 return parser .tokens
6465
You can’t perform that action at this time.
0 commit comments