views:

32

answers:

1

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 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?

+1  A: 

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

stevejalim
Ah, duh, I always forget you can do that. Thanks.
Tom
No worries. Excellent avatar image, btw ;o)
stevejalim