I'll start with an example: Using Jinja2, I can create an environment which is pretty secure (no access to anything but built-ins and objects explicitly marked "safe"), and provide a loader who's templates are loaded from the database (e.g., ``request.client.template_set.all()``), and customize all this for a single request (Since I can simply instantiate an ``Environment`` per request with a custom ``Loader`` which has access to only the ``request.client`` templates). I can also customize the extensions on a per-request basis (that's sort of analogous to customizing template tag/filter built-ins), in order to limit or add to the type of tools that clients have access to.
Using Django templates, I'm left with simply running my clients' sites portion of the app under a different settings file. This *almost* cuts it too (since I can use a different URL conf which includes different template.add_to_builtins() calls, etc.), but it doesn't give me all the things that I need, like the ability to instantiate the loader with a queryset of templates for the ``request.client``, etc. "Why don't you just use Jinja2 then?" The Django core team is a pretty intelligent team, and the philosophy behind the style of tags / filters / lack of logic in Django templates is far superior to Jinja2. I simply want a more Jinja2-ish Python API for using Django templates. My Proposal (abstract explanation, btw, I'd be happy to help architect / write code): Without changing any of the existing functionality or settings in Django, refactor the template system to use an ``Environment`` class (something akin to Jinja2's ``Environment``) which takes a list of loaders, and a number of other arguments. Then, instantiate this class, using the provided settings, and use it for all the default functionality (the admin, render_to_response, CBV template access, etc.). This would allow developers to make their own ``Environment`` instance with different arguments, request-specific or otherwise, and without having to do a lot of evil things. Thanks Fellow Djangonaut -- You received this message because you are subscribed to the Google Groups "Django developers" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-developers/-/h9ExRYxoxHUJ. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.