request object availability
|Reported by:||Joeboy||Owned by:||Adrian Holovaty|
|Severity:||normal||Keywords:||context rendercontext templatetags templatetag|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Ok, I've banged on about this a bit on the lists and not had much response so I'm trying again here.
Suppose I want my django website to differ according to the user that's logged into it. Eg. I want it to say 'Hello Jane Doe', or only display certain bits if the user's logged in, or some such very common thing that relies on the request object. So I put something to that effect in my base.html, make sure the auth context processor is in effect, and all is groovy.
*Except* that that information will only be available to the template if every view in my project uses a RequestContext instead of a vanilla Context, so, I need to go through my projects and change them all. This makes a bit of a mockery of the idea of pluggable apps, unless there's some edict that says all reusable apps should use RequestContext. And that means lots of miscellaneous data floating about in all contexts.
Am I right in considering this to be a rather significant problem? Do the devs envisage doing anything about it, (maybe in all that spare time left over from their day jobs and merging a million SoC branches)? If not, how should I deal with it? Just use RequestContext everywhere and stop whingeing?
What I think I would like, btw, is the ability to set up context processors for individual templatetags. I don't know quite how much that would involve swimming against the tide of the django code, but it would seem to address the problem. I recognise that there's a lot going on in django atm, but it would make me happy to at least get some kind of response about this, especially as people are talking about setting up public app repositories on the list at the moment.