it/itf/frontpage/context_processors.py
2011-08-10 17:10:16 +05:30

13 lines
351 B
Python

from frontpage.models import MenuHeading, MenuItem
def menus(request):
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 {'menus': menus}