From 12d05f4da621275a162d5bbdc750a28565eab014 Mon Sep 17 00:00:00 2001 From: Adam Taylor Date: Tue, 21 May 2024 16:51:52 -0600 Subject: [PATCH] Added support for Django 4.1 through 5.0 --- CHANGES.rst | 5 +++++ src/friendlytagloader/templatetags/friendly_loader.py | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 002ea2b..6e3fd35 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,11 @@ Changes ======= +Unreleased +---------------- + +- Added support for Django 4.1 through 5.0 + 1.3.1 (2018-08-14) ------------------ diff --git a/src/friendlytagloader/templatetags/friendly_loader.py b/src/friendlytagloader/templatetags/friendly_loader.py index 3fd6946..deae171 100644 --- a/src/friendlytagloader/templatetags/friendly_loader.py +++ b/src/friendlytagloader/templatetags/friendly_loader.py @@ -1,4 +1,4 @@ -from django.template import Library, TemplateSyntaxError +from django.template import Library, NodeList, TemplateSyntaxError try: from django.template.base import TokenType @@ -8,8 +8,8 @@ else: TOKEN_BLOCK = TokenType.BLOCK -from django.template.defaulttags import (CommentNode, IfNode, LoadNode, - find_library, load_from_library) +from django.template.defaulttags import (IfNode, LoadNode, find_library, + load_from_library) from django.template.smartif import Literal register = Library() @@ -89,7 +89,7 @@ def do_if_has_tag(parser, token, negate=False): end_tag = 'end%s' % bits[0] has_tag = all([tag in parser.tags for tag in bits[1:]]) has_tag = (not negate and has_tag) or (negate and not has_tag) - nodelist_true = nodelist_false = CommentNode() + nodelist_true = nodelist_false = NodeList() if has_tag: nodelist_true = parser.parse(('else', end_tag)) token = parser.next_token()