Skip to content

Commit

Permalink
Parser.tokens are reversed in Django 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrDlouhy committed Mar 11, 2021
1 parent d62fc64 commit 4350132
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scribbler/templatetags/scribbler_tags.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"Template tags for rendering snippet content."
import django
from django import template
from django.template import base as template_base
from django.conf import settings
Expand Down Expand Up @@ -101,6 +102,9 @@ def render(self, context):
def rebuild_template_string(tokens):
"Reconstruct the original template from a list of tokens."
result = ''
if django.VERSION >= (3, 1, 0):
# For some reason in Django 3.1 the token list is reversed
list.reverse(tokens)
for token in tokens:
value = token.contents
if token.token_type == TOKEN_VAR:
Expand Down

0 comments on commit 4350132

Please sign in to comment.