I want to inject one additional variable into the context of a view that belongs to a 3rd-party application without editing the code of that application. Is there a way to do this by wrapping the (non-generic) view? It doesn't accept an extra_context parameter, so the approach described in this SO thread won't work. I know I could create a context processor, but that seems like a lot of开发者_JAVA技巧 overhead, having this variable available on every page when I just want it in one view. Or is there a way to narrow the scope of a context processor?
I think a context processor is the way to go, but with a splash of logic in there that checks the request path (for instance) and only bothers digging out and setting the variable for the occasions when it's needed
精彩评论