summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsobolevn <mail@sobolevn.me>2024-07-20 09:56:22 +0300
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-07-22 08:38:46 +0200
commit2ff917fd06e5155920e085837a2cfab73604e3e4 (patch)
treeb21017fb8316cf1c67d33ba48b528e2e3df7ec2e
parent1029a4694e5390e8c6ec88a6a2192c2e32bb5430 (diff)
Applied optimizations to template.utils.get_app_template_dirs().
-rw-r--r--django/template/utils.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/django/template/utils.py b/django/template/utils.py
index 2b118f900e..05e9d46cad 100644
--- a/django/template/utils.py
+++ b/django/template/utils.py
@@ -102,10 +102,9 @@ def get_app_template_dirs(dirname):
dirname is the name of the subdirectory containing templates inside
installed applications.
"""
- template_dirs = [
- Path(app_config.path) / dirname
- for app_config in apps.get_app_configs()
- if app_config.path and (Path(app_config.path) / dirname).is_dir()
- ]
# Immutable return value because it will be cached and shared by callers.
- return tuple(template_dirs)
+ return tuple(
+ path
+ for app_config in apps.get_app_configs()
+ if app_config.path and (path := Path(app_config.path) / dirname).is_dir()
+ )