from django import template
from ..models import MenuItem

register = template.Library()

@register.inclusion_tag('site/_menu.html')
def show_menu(active=None):
    menu_items = []
    for _item in MenuItem.published.all():
        menu_item = {
            'title': _item.title,
            'url': _item.url,
            'target': _item.get_target_display(),
        }
        if _item.slug == active:
            menu_item['active'] = True
        menu_items.append(menu_item)

    return {'menu': menu_items}


99c703f295b903aab0a7a092edc3ec82d84fd13a
<mask token>

<mask token>


@register.inclusion_tag('site/_menu.html')
def show_menu(active=None):
    menu_items = []
    for _item in MenuItem.published.all():
        menu_item = {'title': _item.title, 'url': _item.url, 'target':
            _item.get_target_display()}
        if _item.slug == active:
            menu_item['active'] = True
        menu_items.append(menu_item)
    return {'menu': menu_items}

<mask token>
register = template.Library()


@register.inclusion_tag('site/_menu.html')
def show_menu(active=None):
    menu_items = []
    for _item in MenuItem.published.all():
        menu_item = {'title': _item.title, 'url': _item.url, 'target':
            _item.get_target_display()}
        if _item.slug == active:
            menu_item['active'] = True
        menu_items.append(menu_item)
    return {'menu': menu_items}

from django import template
from ..models import MenuItem
register = template.Library()


@register.inclusion_tag('site/_menu.html')
def show_menu(active=None):
    menu_items = []
    for _item in MenuItem.published.all():
        menu_item = {'title': _item.title, 'url': _item.url, 'target':
            _item.get_target_display()}
        if _item.slug == active:
            menu_item['active'] = True
        menu_items.append(menu_item)
    return {'menu': menu_items}

from django import template
from ..models import MenuItem

register = template.Library()

@register.inclusion_tag('site/_menu.html')
def show_menu(active=None):
    menu_items = []
    for _item in MenuItem.published.all():
        menu_item = {
            'title': _item.title,
            'url': _item.url,
            'target': _item.get_target_display(),
        }
        if _item.slug == active:
            menu_item['active'] = True
        menu_items.append(menu_item)

    return {'menu': menu_items}

