diff options
| author | Nick Pope <nick@nickpope.me.uk> | 2023-11-24 11:06:29 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-24 12:06:29 +0100 |
| commit | 5e28cd3f2cfc31bf947a747256bc036f8f64888a (patch) | |
| tree | 7f687c30cd0bec4aec9837c7b311b616ebd8c4e1 /django/template | |
| parent | eabfa2d0e38670365aa74117ad2f8710b81065c5 (diff) | |
Fixed #34983 -- Deprecated django.utils.itercompat.is_iterable().
Diffstat (limited to 'django/template')
| -rw-r--r-- | django/template/defaulttags.py | 4 | ||||
| -rw-r--r-- | django/template/library.py | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index 188bdf8c05..40c2917f56 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -3,6 +3,7 @@ import re import sys import warnings from collections import namedtuple +from collections.abc import Iterable from datetime import datetime from itertools import cycle as itertools_cycle from itertools import groupby @@ -10,7 +11,6 @@ from itertools import groupby from django.conf import settings from django.utils import timezone from django.utils.html import conditional_escape, escape, format_html -from django.utils.itercompat import is_iterable from django.utils.lorem_ipsum import paragraphs, words from django.utils.safestring import mark_safe @@ -1198,7 +1198,7 @@ def query_string(context, query_dict=None, **kwargs): if value is None: if key in query_dict: del query_dict[key] - elif is_iterable(value) and not isinstance(value, str): + elif isinstance(value, Iterable) and not isinstance(value, str): query_dict.setlist(key, value) else: query_dict[key] = value diff --git a/django/template/library.py b/django/template/library.py index 16db79e4cd..4ee96cea89 100644 --- a/django/template/library.py +++ b/django/template/library.py @@ -1,9 +1,9 @@ +from collections.abc import Iterable from functools import wraps from importlib import import_module from inspect import getfullargspec, unwrap from django.utils.html import conditional_escape -from django.utils.itercompat import is_iterable from .base import Node, Template, token_kwargs from .exceptions import TemplateSyntaxError @@ -263,7 +263,9 @@ class InclusionNode(TagHelperNode): t = self.filename elif isinstance(getattr(self.filename, "template", None), Template): t = self.filename.template - elif not isinstance(self.filename, str) and is_iterable(self.filename): + elif not isinstance(self.filename, str) and isinstance( + self.filename, Iterable + ): t = context.template.engine.select_template(self.filename) else: t = context.template.engine.get_template(self.filename) |
