diff --git a/django/template/base.py b/django/template/base.py
index 49ef0b8..02f947a 100644
a
|
b
|
class Library(object):
|
927 | 927 | else: |
928 | 928 | t = get_template(file_name) |
929 | 929 | self.nodelist = t.nodelist |
930 | | new_context = context_class(dict, autoescape=context.autoescape) |
| 930 | new_context = context_class(dict, autoescape=context.autoescape, current_app=context.current_app) |
931 | 931 | # Copy across the CSRF token, if present, because inclusion |
932 | 932 | # tags are often used for forms, and we need instructions |
933 | 933 | # 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 a517bd1..289238c 100644
a
|
b
|
class CustomTagTests(TestCase):
|
52 | 52 | register = template.Library() |
53 | 53 | decorator = register.simple_tag(takes_context=True) |
54 | 54 | self.assertRaises(template.TemplateSyntaxError, decorator, a_simple_tag_without_parameters) |
| 55 | |
| 56 | def test_15070(self): |
| 57 | ''' |
| 58 | Test that inclusion tag passes down `current_app` of context to the |
| 59 | Context of the included/rendered template as well. |
| 60 | ''' |
| 61 | c = template.Context({}) |
| 62 | t = template.Template('{% load custom %}{% inclusion_tag_no_params %}') |
| 63 | self.assertEquals(t.render(c), u'None') |
| 64 | |
| 65 | c.current_app = 'advanced' |
| 66 | self.assertEquals(t.render(c), 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 7011316..588ad69 100644
a
|
b
|
def params_and_context(context, arg):
|
39 | 39 | return "params_and_context - Expected result (context value: %s): %s" % (context['value'], arg) |
40 | 40 | params_and_context.anything = "Expected params_and_context __dict__" |
41 | 41 | |
| 42 | @register.simple_tag(takes_context=True) |
| 43 | def current_app(context): |
| 44 | return "%s" % context.current_app |
| 45 | |
| 46 | @register.inclusion_tag('test_incl_tag.html', takes_context=True) |
| 47 | def inclusion_tag_no_params(context): |
| 48 | return {} |