"""
This file was generated with the custommenu management command, it contains
the classes for the admin menu, you can customize this class as you want.

To activate your custom menu add the following to your settings.py::
    ADMIN_TOOLS_MENU = 'visitas.menu.CustomMenu'
"""
from admin_tools.menu.items import MenuItem
from admin_tools.menu.models import AppListMenuItem

from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _

from admin_tools.menu import items, Menu


class CustomMenu(Menu):
    """
    Custom Menu for visitas admin site.
    """
    def __init__(self, **kwargs):
        Menu.__init__(self, **kwargs)
        self.children.append(
            MenuItem(title='Home', url=reverse('admin:index')),
        )

        self.children.append(
            MenuItem(
                title='Consultas',
                children=[
                    MenuItem(title='Por Filtos', url=reverse('consulta_filtros')),
                    MenuItem('Predefinidas'),
                    MenuItem('Lista de Visitas'),
                ]
            ),
        )

        self.children += [
            items.ModelList('Catalogos', ['visitas_stg.models.*',])
        ]

        self.children += [
            items.ModelList('Usuarios', ['django.contrib.auth.*',])
        ]

    def init_with_context(self, context):
        """
        Use this method if you need to access the request context.
        """
        return super(CustomMenu, self).init_with_context(context)
