0

I need to load some templates which path depends of their context. I created a custom Loader. How can I access to the context of the template from my custom template loader?

Jorge Barata
  • 2,227
  • 1
  • 20
  • 26

1 Answers1

0

Could you give an example of what kind of project structure you have?

Is it:

    myproject/
        myapps1/templates/myapp_template

or is it the regular:

    myproject/
        myapps1
        templates/myapps1/myapp_template

The reason for asking is that a lot of issues can be solved through template tags, url.py and the project structure.

In the first type, you might need custom loaders. In the second, template tags and the myapps1/urls.pywould do the trick.

Afrowave
  • 911
  • 9
  • 21
  • I have come to the conclusion that there is no way of obtaining the context from a template loader, so finally I overwrote the rendering function of the `TemplateView` and developed a custom `include` template tag :) ty! – Jorge Barata Apr 08 '12 at 10:27
  • Excellent. I'll use that in the future some where. – Afrowave Apr 27 '12 at 10:17