﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
17553	Modify render_to_string to pass TEMPLATE_LOADERS the context_instance arguments	bishanty@…	nobody	"I propose that `render_to_string` be modified to pass `context_instance` all the way down to `TEMPLATE_LOADERS`. 

This change would allow template loaders to dynamically select a template according to the context. For example, to instrument an A/B test by checking the request in a context or to return a mobile template to a mobile user agent:


{{{
from django.template.loaders.filesystem import load_template_source as default_template_loader

def mobile_loader(template_name, template_dirs=None, context_instance=None):
    if context_instance is not None:
        if context_instance['mobile']:
            template_name = 'm' + template_name
    return default_template_loader(template_name, template_dirs, context_instance)
}}}
     
At the `render_to_string` level, this would allow you to change the rendering of most pluggable apps as well."	Uncategorized	closed	Template system	1.3	Normal	needsinfo	template loaders		Unreviewed	0	0	0	0	0	0
