A
A
Andrew2012-09-11 00:06:00
Django
Andrew, 2012-09-11 00:06:00

How to make the template processor work only for the right application\reference?

Good afternoon!
The point is this. There is a project, applications (apps) are connected to it, different. There are some template processors that transform the context. Some are required in one app, some in another. This is not correct, in my opinion. But dzhanga, as I understand it, cannot disable processors for one link and enable them for another.
Or can? Any solutions? Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
marazmiki, 2012-09-11
@xmdy

Context processors are global. And there is nothing wrong with the fact that some of the connected processors are not used in certain applications. Default context processors are lazy (i.e., they will not perform any calculations until they explicitly access one or another context variable). If you write your own in the same lazy-style, nothing terrible will happen.
If you really, really want to disable some of the context processors in a particular application, you can use threadlocals to patch settings.TEMPLATE_CONTEXT_PROCESSORSfor the current request. But this is ugly and generally a crutch, nmvz.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question