From d8ae4c9144dd2fa074b1790928d2a31b1f966602 Mon Sep 17 00:00:00 2001
From: DaNmarner <DaNmarner@gmail.com>
Date: Fri, 23 Jul 2010 01:54:01 -0500
Subject: [PATCH] Added template_name as a return value of django.template.select_template
---
django/template/loader.py | 2 +-
docs/ref/templates/api.txt | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/django/template/loader.py b/django/template/loader.py
index b807752..89f7aa5 100644
a
|
b
|
def select_template(template_name_list):
|
189 | 189 | "Given a list of template names, returns the first that can be loaded." |
190 | 190 | for template_name in template_name_list: |
191 | 191 | try: |
192 | | return get_template(template_name) |
| 192 | return get_template(template_name), template_name |
193 | 193 | except TemplateDoesNotExist: |
194 | 194 | continue |
195 | 195 | # If we get here, none of the templates could be loaded |
diff --git a/docs/ref/templates/api.txt b/docs/ref/templates/api.txt
index 3e26753..8dd47fb 100644
a
|
b
|
Django has two ways to load templates from files:
|
528 | 528 | .. function:: django.template.loader.select_template(template_name_list) |
529 | 529 | |
530 | 530 | ``select_template`` is just like ``get_template``, except it takes a list |
531 | | of template names. Of the list, it returns the first template that exists. |
| 531 | of template names. Of the list, it returns the first template that exists |
| 532 | and its name. |
532 | 533 | |
533 | 534 | For example, if you call ``get_template('story_detail.html')`` and have the |
534 | 535 | above :setting:`TEMPLATE_DIRS` setting, here are the files Django will look for, |