Q:

Passing an object in every Django page

I have an object called Groups that is used in every single page on my website.  However, Django only passes in Python objects to html through render_to_response and I can't render to response everytime something happens to the groups object. 
How do I maintain this object(as in make it respond to adding and deletion) and produce it in every Django template that I have without calling render_to_response?  

A:

write a template context processor:
#my_context_processors.py

def include_groups(request):
    #perform your logic to create your list of groups
    groups = []
    return {'groups':groups}

then add it in your settings file:
#settings.py

TEMPLATE_CONTEXT_PROCESSORS = (
     "django.core.context_processors.auth",
     "django.core.context_processors.debug",
     "django.core.context_processors.i18n",
     "django.core.context_processors.media",
     "path.to.my_context_processors.include_groups",
)

now a variable groups will be available to you in all your templates

