added context processor for menu items

This commit is contained in:
Sanj 2011-08-10 01:00:07 +05:30
parent a383f3ed04
commit e22c482d52
2 changed files with 2 additions and 10 deletions

View File

@ -12,16 +12,7 @@ def index(request):
except: except:
statuses = [] statuses = []
boxes = SliderBox.objects.all() boxes = SliderBox.objects.all()
menuHeads = MenuHeading.objects.all()
menus = []
for m in menuHeads:
d = {
'name': m.name,
'items': [{'name': item.name, 'url': item.url} for item in m.menuitem_set.all()]
}
menus.append(d)
return render_to_response("noel/index.html", RequestContext(request, { return render_to_response("noel/index.html", RequestContext(request, {
'tweets': statuses[0:5], 'tweets': statuses[0:5],
'boxes': boxes, 'boxes': boxes
'menus': menus
})) }))

View File

@ -85,6 +85,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
"django.core.context_processors.i18n", "django.core.context_processors.i18n",
"django.core.context_processors.media", "django.core.context_processors.media",
"multilingual.context_processors.multilingual", "multilingual.context_processors.multilingual",
"frontpage.context_processors.menus"
) )
# URL that handles the media served from MEDIA_ROOT. Make sure to use a # URL that handles the media served from MEDIA_ROOT. Make sure to use a