【发布时间】:2017-01-06 21:21:18
【问题描述】:
我想向我的所有模板显示我的通知。在我的设置中,我有:
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' ,
],
},
},
]
helpers/views.py
def notifications():
notifications = {'A':'aaa' , 'B':'bbb' }
return {'notifications': notifications }
我的模板中没有任何内容 - 我做错了什么? 在模板中:
{{notifications.A}}
【问题讨论】:
-
请展示你的观点
标签: python django python-3.x django-1.9