There's no reason a view needs to be a function. You can easily make 
views out of classes. In which case you can stuff some of these things 
in the class __init__ and not have to about them for each view.

On 5/6/2009 3:37 PM, ringemup wrote:
> Hm, and RequestContext has to be instantiated from every view for
> which one wants to use the context processor anyway, huh?
> 
> I always feel like I'm repeating myself when passing global context to
> every single template.
> 
> On May 6, 5:13 pm, George Song <geo...@damacy.net> wrote:
>> On 5/6/2009 1:37 PM, ringemup wrote:
>>
>>> I've got some context that every view in one of my apps needs to pass
>>> to its templates... but that I don't want to have to run for pages
>>> that don't use that app, since it executes a lot of queries.  Is there
>>> a way to execute the context processor only for views defined in that
>>> app's URL conf or something?
>> You can specify extra context processors to use with RequestContext in
>> your view:
>>
>> <http://docs.djangoproject.com/en/dev/ref/templates/api/#id1>

-- 
George

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to