Source code for shoop.admin.menu
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django.utils.datastructures import SortedDict
from django.utils.encoding import force_text
from shoop.admin.module_registry import get_modules
from shoop.admin.utils.permissions import get_missing_permissions
class _MenuCategory(object):
"""
Internal menu category object.
"""
def __init__(self, name, icon):
self.name = name
self.icon = icon
self.entries = []
def __iter__(self):
return iter(sorted(self.entries, key=lambda e: e.text))