# Path: core/snippets.py
# class NavigationMenu(ClusterableModel):
# 
#     objects = NavigationMenuManager()
#     menu_name = models.CharField(max_length=255, null=False, blank=False)
# 
#     @property
#     def items(self):
#         return self.menu_items.all()
# 
#     def __str__(self):
#         return self.menu_name
# 
#     class Meta:
#         verbose_name = "Navigation menu"


import urllib.error
import urllib.parse
import urllib.request
from django import template
from django.core.exceptions import ObjectDoesNotExist
from core.snippets import NavigationMenu
from wagtail.wagtailcore.models import Page



register = template.Library()


@register.inclusion_tag('core/includes/menu.html', takes_context=True)
def menu(context, name=None, current_page=None):
    """
    Retrieves the MenuElement(s) under the NavigationMenu with given menu_name
    """
    if name is None or current_page is None:
        return None
    try:

# Path: core/snippets.py
# class NavigationMenu(ClusterableModel):
# 
#     objects = NavigationMenuManager()
#     menu_name = models.CharField(max_length=255, null=False, blank=False)
# 
#     @property
#     def items(self):
#         return self.menu_items.all()
# 
#     def __str__(self):
#         return self.menu_name
# 
#     class Meta:
#         verbose_name = "Navigation menu"


# Path: core/templatetags/core_tags.py
import urllib.error
import urllib.parse
import urllib.request
from django import template
from django.core.exceptions import ObjectDoesNotExist
from core.snippets import NavigationMenu
from wagtail.wagtailcore.models import Page




register = template.Library()


@register.inclusion_tag('core/includes/menu.html', takes_context=True)
def menu(context, name=None, current_page=None):
    """
    Retrieves the MenuElement(s) under the NavigationMenu with given menu_name
    """
    if name is None or current_page is None:
        return None
    try:

        menu_items = NavigationMenu.objects.get(menu_name=name).items