diff --git a/django/template/base.py b/django/template/base.py
index b8d6c13..1babda9 100644
a
|
b
|
class Library(object):
|
928 | 928 | else: |
929 | 929 | t = get_template(file_name) |
930 | 930 | self.nodelist = t.nodelist |
931 | | new_context = context_class(dict, autoescape=context.autoescape) |
| 931 | new_context = context_class(dict, autoescape=context.autoescape, current_app=context.current_app) |
932 | 932 | # Copy across the CSRF token, if present, because inclusion |
933 | 933 | # tags are often used for forms, and we need instructions |
934 | 934 | # for using CSRF protection to be as simple as possible. |
diff --git a/tests/regressiontests/templates/custom.py b/tests/regressiontests/templates/custom.py
index fe5b095..36ca712 100644
a
|
b
|
class CustomTagTests(TestCase):
|
78 | 78 | self.verify_tag(custom.inclusion_explicit_no_context, 'inclusion_explicit_no_context') |
79 | 79 | self.verify_tag(custom.inclusion_no_params_with_context, 'inclusion_no_params_with_context') |
80 | 80 | self.verify_tag(custom.inclusion_params_and_context, 'inclusion_params_and_context') |
| 81 | |
| 82 | def test_15070(self): |
| 83 | ''' |
| 84 | Test that inclusion tag passes down `current_app` of context to the |
| 85 | Context of the included/rendered template as well. |
| 86 | ''' |
| 87 | c = template.Context({}) |
| 88 | t = template.Template('{% load custom %}{% inclusion_tag_no_params %}') |
| 89 | self.assertEquals(t.render(c).strip(), u'None') |
| 90 | |
| 91 | c.current_app = 'advanced' |
| 92 | self.assertEquals(t.render(c).strip(), u'advanced') |
diff --git a/tests/regressiontests/templates/templates/test_incl_tag.html b/tests/regressiontests/templates/templates/test_incl_tag.html
new file mode 100644
index 0000000..ab2fe63
-
|
+
|
|
| 1 | {% load custom %}{% current_app %} |
diff --git a/tests/regressiontests/templates/templatetags/custom.py b/tests/regressiontests/templates/templatetags/custom.py
index b2e8a16..bbdbbcf 100644
a
|
b
|
def inclusion_params_and_context(context, arg):
|
69 | 69 | return {"result" : "inclusion_params_and_context - Expected result (context value: %s): %s" % (context['value'], arg)} |
70 | 70 | inclusion_params_and_context.anything = "Expected inclusion_params_and_context __dict__" |
71 | 71 | |
| 72 | @register.simple_tag(takes_context=True) |
| 73 | def current_app(context): |
| 74 | return "%s" % context.current_app |
| 75 | |
| 76 | @register.inclusion_tag('test_incl_tag.html', takes_context=True) |
| 77 | def inclusion_tag_no_params(context): |
| 78 | return {} |