
    &gQ                         d Z 	 ddlmZ ddlmZ ddl	m
Z
 ddlmZ  G d de      Z G d	 d
e      Zy# e$ r ddlmZ ddlmZ Y 6w xY w)z4
Module where admin tools menu classes are defined.
    )reverse)gettext_lazy)ugettext_lazy)items)get_admin_site_namec                   8    e Zd ZdZdZdZ G d d      Zd Zd Zy)Menua  
    This is the base class for creating custom navigation menus.
    A menu can have the following properties:

    ``template``
        A string representing the path to template to use to render the menu.
        As for any other template, the path must be relative to one of the
        directories of your ``TEMPLATE_DIRS`` setting.
        Default value: "admin_tools/menu/menu.html".

    ``children``
        A list of children menu items. All children items mus be instances of
        the :class:`~admin_tools.menu.items.MenuItem` class.

    If you want to customize the look of your menu and it's menu items, you
    can declare css stylesheets and/or javascript files to include when
    rendering the menu, for example::

        from admin_tools.menu import Menu

        class MyMenu(Menu):
            class Media:
                css = {'all': ('css/mymenu.css',)}
                js = ('js/mymenu.js',)

    Here's a concrete example of a custom menu::

        from django.core.urlresolvers import reverse
        from admin_tools.menu import items, Menu

        class MyMenu(Menu):
            def __init__(self, **kwargs):
                super(MyMenu, self).__init__(**kwargs)
                self.children += [
                    items.MenuItem('Home', reverse('admin:index')),
                    items.AppList('Applications'),
                    items.MenuItem('Multi level menu item',
                        children=[
                            items.MenuItem('Child 1', '/foo/'),
                            items.MenuItem('Child 2', '/bar/'),
                        ]
                    ),
                ]

    Below is a screenshot of the resulting menu:

    .. image:: images/menu_example.png
    zadmin_tools/menu/menu.htmlNc                       e Zd ZdZdZy)
Menu.Media N)__name__
__module____qualname__cssjsr       O/var/www/html/djangosite/lib/python3.12/site-packages/admin_tools/menu/menus.pyMediar   E   s    r   r   c                     |D ])  }t        | j                  |      st        | |||          + |j                  dg       | _        y )Nchildren)hasattr	__class__setattrgetr   )selfkwargskeys      r   __init__zMenu.__init__I   sC     	0Ct~~s+c6#;/	0 

:r2r   c                      y)az  
        Sometimes you may need to access context or request variables to build
        your menu, this is what the ``init_with_context()`` method is for.
        This method is called just before the display with a
        ``django.template.RequestContext`` as unique argument, so you can
        access to all context variables and to the ``django.http.HttpRequest``.
        Nr   )r   contexts     r   init_with_contextzMenu.init_with_contextO   s     	r   )	r   r   r   __doc__templater   r   r   r!   r   r   r   r	   r	      s(    /` ,HH 3r   r	   c                       e Zd ZdZd Zy)DefaultMenua@  
    The default menu displayed by django-admin-tools.
    To change the default menu you'll have to type the following from the
    commandline in your project root directory::

        python manage.py custommenu

    And then set the ``ADMIN_TOOLS_MENU`` settings variable to point to your
    custom menu class.
    c           
      :   t        |      }| xj                  t        j                  t	        d      t        d|z              t        j                         t        j                  t	        d      d      t        j                  t	        d      d      gz  c_        y )N	Dashboardz%s:indexApplications)zdjango.contrib.*)excludeAdministration)models)r   r   r   MenuItem_r   	BookmarksAppList)r   r    	site_names      r   r!   zDefaultMenu.init_with_contexte   sv    '0	NN1[>7:	3I+JKOOMM.!- MM"#,
 	
r   N)r   r   r   r"   r!   r   r   r   r%   r%   Z   s    	
r   r%   N)r"   django.urlsr   django.utils.translationr   r-   ImportErrordjango.core.urlresolversr   admin_tools.menur   admin_tools.utilsr   objectr	   r%   r   r   r   <module>r8      sR   < $: # 1F6 FR
$ 
a  <0;<s   3 AA