passing a dictionary to all templates using context_processors
<p>I want to show my notification to all my templates. In my settings I have:</p>

<pre><code>TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')]
        ,
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                'helpers.views.notifications' ,
            ],
        },
    },
]
</code></pre>

<p>helpers/views.py</p>

<pre><code>def notifications():
    notifications =  {'A':'aaa' , 'B':'bbb' }
    return {'notifications': notifications }
</code></pre>

<p>I get nothing in my template - what am I doing wrong? 
in template :</p>

<pre><code>{{notifications.A}}
</code></pre>

<p>Your <code>TEMPLATES</code> setting looks ok. In your context processor, you don't need to use <code>RequestContext</code>. Just return a dictionary. If you are using Django 1.9 or earlier, you <strong>must</strong> call the method <code>request.user.is_authenticated()</code> otherwise <code>request.user.is_authenticated</code> will always evaluate to True.</p>

<pre><code>def notifications(request):
    if request.user.is_authenticated():  # Use request.user.is_authenticated for Django &gt;= 1.10
        notifications  = {'default: 'logged in', ... }
    else:
        notifications =  {'default':'not logged in', ...}
    return {'notifications': notifications }
</code></pre>

<p>Then in your tempalate, you can access <code>{{ notifications.default }}</code></p>

python django python-3.x django-1.9