Beispiel #1
0
    def init_with_context(self, context):
        request = context['request']

        configuracoes_children = []
        if context.get('request').user.has_perm('auth.view_filebrowser'):
            configuracoes_children.append(
                items.MenuItem(title=_(u'Visualizador de Arquivos'),
                               url=reverse('filebrowser:fb_browse')))

        financeiro_children = []
        if request.user.has_perm('auth.view_caixa'):
            financeiro_children.append(
                items.MenuItem(u'Caixa', reverse('financeiro_caixa')))

        self.children += [
            items.MenuItem(' ', reverse('admin:index')),
            items.Bookmarks(_('Favoritos')),
            CustomAppList(
                u'CMS',
                exclude=(
                    'raizcidadanista.cms.models.EmailAgendado',
                    'raizcidadanista.cms.models.Recurso',
                    'raizcidadanista.cms.models.Theme',
                ),
                models=(
                    'raizcidadanista.cms.models.Section',
                    'raizcidadanista.cms.models.Article',
                    'raizcidadanista.cms.models.ArticleComment',
                    'raizcidadanista.cms.models.Menu',
                ),
            ),
            CustomAppList(u'Configurações',
                          models=(
                              'raizcidadanista.cms.models.Recurso',
                              'raizcidadanista.cms.models.Theme',
                              'raizcidadanista.cms.models.URLNotFound',
                          ),
                          children=configuracoes_children),
            CustomAppList(
                u'Cadastro',
                models=('cadastro.models.*', ),
                exclude=('cadastro.models.ListaCadastro', ),
            ),
            CustomAppList(
                u'Fórum',
                models=('forum.models.*', ),
            ),
            CustomAppList(u'Financeiro',
                          models=('financeiro.models.*', ),
                          children=financeiro_children),
            CustomAppList(
                u'Adminstração',
                models=(
                    'django.contrib.*',
                    'utils.models.*',
                    'raizcidadanista.cms.models.EmailAgendado',
                ),
                exclude=('django.contrib.sites.models.*', ),
            ),
        ]
Beispiel #2
0
 def get_children(self):
     children = [
         items.AppList(title=_('Applications'), ),
         # items.AppList(
         #     title=_('Applications'),
         #     exclude=('django.contrib.*',),
         #     exclude_list=('django.contrib.*'),
         # ),
         # items.AppList(
         #     title=_('Administration'),
         #     models=('django.contrib.*',)
         # ),
         items.MenuItem(title=_('Dashboard'), url=reverse('admin:index')),
         items.MenuItem(title='Multi level menu item',
                        children=[
                            items.MenuItem(title='Child 1', url='/foo/'),
                            items.MenuItem(title='Child 2', url='/bar/'),
                        ]),
         HistoryMenuItem(),
         items.Bookmarks(),
         # items.Bookmarks(
         #     'My bookmarks'
         # ),
         items.ModelList(
             'Authentication',
             # ['django.contrib.auth.*',]
             [
                 'sw_shop.sw_catalog.*',
             ],
         )
     ]
     return children
Beispiel #3
0
 def __init__(self, **kwargs):
     Menu.__init__(self, **kwargs)
     self.children += [
         items.MenuItem(_('Alarm'), reverse('admin:index')),
         items.AppList(_('Applications'), exclude=('django.contrib.*', )),
         items.AppList(_('Administration'), models=('django.contrib.*', ))
     ]
     self.children.append(
         items.MenuItem(_('Ferramentas'),
                        children=[
                            items.MenuItem('Inserir Recomendador', 'code'),
                            items.MenuItem('Gerenciar Recomendadores',
                                           'managercodes'),
                        ]))
     self.children.append(
         items.MenuItem(
             _('Gráficos'),
             children=[
                 items.MenuItem('Recomendação gerada',
                                'recomendacaoGerada'),
                 items.MenuItem('Recomendação acessada',
                                'recomendacaoAcessada'),
                 items.MenuItem('Recomendação aderida por clique',
                                'recomendacaoAderida'),
                 items.MenuItem('Recomendação aderida por recomendador',
                                'recomendacaoAderidaPorGeracao'),
                 items.MenuItem('Eficiência dos recomendadores',
                                'recomendacaoEficiencia'),
             ]))
Beispiel #4
0
    def init_with_context(self, context):
        # Link to home and bookmarks
        self.children.append(
            items.MenuItem(u'Dashboard', reverse(u'admin:index')))
        self.children.append(items.Bookmarks())

        # Links submenu
        self.children.append(
            items.MenuItem(
                u'Administration',
                children=[self._create_link(**l) for l in ADMIN_LINKS]))

        # Models submenu
        self.children.append(
            items.MenuItem(u'Models',
                           children=[
                               self._create_model_group(**g)
                               for g in ADMIN_MODEL_GROUPS
                           ]))
        self.children[-1].children.append(
            items.AppList(u'Other Models', exclude=self._used_models()))

        # Pages
        self.children.append(
            items.MenuItem(u'Pages',
                           children=[
                               self._create_link(n, u'admin:pages_index', [l])
                               for l, n in settings.LANGUAGES
                           ]))
Beispiel #5
0
    def __init__(self, **kwargs):
        Menu.__init__(self, **kwargs)
        self.children += [
            items.MenuItem(_('Dashboard'), reverse('admin:index')),
        ]

        # Foo
        self.children.append(items.ModelList(_('Foo'), models=conf.foo_apps))

        # Fobi
        self.children.append(
            items.MenuItem(_('Fobi'),
                           children=[
                               items.ModelList(_('Plugins'),
                                               models=conf.fobi_plugins),
                               items.ModelList(_('Forms'),
                                               models=conf.fobi_forms),
                               items.ModelList(_('Data'),
                                               models=conf.fobi_data),
                           ]))

        if 'feincms' in settings.INSTALLED_APPS:
            # FeinCMS pages integration
            self.children.append(
                items.AppList(_('FeinCMS Pages'), models=conf.feincms_pages))

        if 'cms' in settings.INSTALLED_APPS:
            # DjangoCMS pages integration
            self.children.append(
                items.AppList(_('DjangoCMS Pages'),
                              models=conf.djangocms_pages))

        # append an app list module for "Administration"
        self.children.append(
            items.AppList(_('Administration'), models=['django.contrib.*']))
Beispiel #6
0
 def __init__(self, **kwargs):
     Menu.__init__(self, **kwargs)
     self.children += [
         items.MenuItem(_("Dashboard"), reverse("admin:index")),
         items.MenuItem(_("Users"), reverse("admin:users_user_changelist")),
         items.MenuItem(_("Containers"),
                        reverse("admin:containers_container_changelist")),
         items.MenuItem(_("Categories"),
                        reverse("admin:categories_category_changelist")),
         items.MenuItem(_("Products"),
                        reverse("admin:products_product_changelist")),
         items.MenuItem(_("Orders"),
                        reverse("admin:orders_order_changelist")),
         items.MenuItem(
             _("Logistics"),
             children=[
                 items.MenuItem(_("Routes"),
                                reverse("admin:routes_route_changelist")),
                 items.MenuItem(_("Jobs"),
                                reverse("admin:jobs_job_changelist")),
                 items.MenuItem(_("Trucks"),
                                reverse("admin:trucks_truck_changelist")),
             ],
         ),
     ]
Beispiel #7
0
    def init_with_context(self, context):
        """
        Use this method if you need to access the request context.
        """

        settings_menu = [
            items.MenuItem(_("Overlays"),
                           reverse("admin:overlays_overlay_changelist")),
            items.MenuItem(_("Region"),
                           reverse("admin:common_region_changelist")),
            items.MenuItem(_("Settings"),
                           reverse("admin:settings_setting_changelist")),
        ]

        if context.request.user.is_superuser:
            settings_menu += [
                items.MenuItem(
                    _("Global settings"),
                    reverse("admin:settings_globalsetting_changelist"),
                ),
            ]

        self.children += [
            items.MenuItem(
                _("Settings"),
                children=settings_menu,
            ),
        ]

        return super(CustomMenu, self).init_with_context(context)
Beispiel #8
0
def add_to_menu(sender, **kwargs):
    m = kwargs.get('menu')
    m.children[1].children = m.children[1].children + [
        items.MenuItem(_('Stocks'), reverse('admin:stocks_stock_changelist')),
        items.MenuItem(_('Albaranes'),
                       reverse('admin:stocks_stocknote_changelist'))
    ]
Beispiel #9
0
 def __init__(self, **kwargs):
     Menu.__init__(self, **kwargs)
     self.children += [
         items.MenuItem(u' ', '/'),
         items.MenuItem(_('Dashboard'), reverse('admin:index')),
         items.Bookmarks(),
         items.AppList(
             _('Content'),
             models=itemlist_content,
         ),
         items.AppList(
             _('Structure'),
             models=itemlist_structure,
         ),
         items.AppList(
             _('Second Life'),
             models=itemlist_sl,
         ),
         items.AppList(
             _('System'),
             models=itemlist_system,
         ),
         items.AppList(
             _('Miscellaneous'),
             exclude=itemlist_misc_exclude,
         ),
     ]
Beispiel #10
0
    def init_with_context(self, context):
        context_items = self._visible_models(context['request'])
        apps = {}
        for model, perms in context_items:
            if not perms['change']:
                continue
            app_label = model._meta.app_label
            if app_label not in apps:
                apps[app_label] = {
                    'title': capfirst(model._meta.app_config.verbose_name),
                    'url': self._get_admin_app_list_url(model, context),
                    'models': []
                }
            apps[app_label]['models'].append({
                'title':
                capfirst(model._meta.verbose_name_plural),
                'url':
                self._get_admin_change_url(model, context)
            })

        for app in sorted(apps, key=lambda k: apps[k]['title']):
            app_dict = apps[app]
            item = items.MenuItem(title=app_dict['title'], url=app_dict['url'])
            # sort model list alphabetically
            apps[app]['models'].sort(key=lambda x: x['title'])
            for model_dict in apps[app]['models']:
                item.children.append(items.MenuItem(**model_dict))
            self.children.append(item)
Beispiel #11
0
    def init_with_context(self, context):
        request = context['request']

        self.children += [
            items.MenuItem(u'Histórico dos Candidatos', '/'),
            items.MenuItem(u'Resumo por Eleição', reverse('eleicoes_busca')),
            items.MenuItem(u'Busca detalhada', reverse('dashboard')),
            items.MenuItem(u'Sobre', 'http://www.farmi.pro.br/politlab'),
        ]
Beispiel #12
0
 def __init__(self, **kwargs):
     Menu.__init__(self, **kwargs)
     self.children += [
         items.MenuItem(_('Dashboard'), reverse('admin:index')),
         items.Bookmarks(),
         items.AppList(_('Applications'), exclude=('django.contrib.*', )),
         items.AppList(_('Administration'), models=('django.contrib.*', )),
         items.MenuItem(_('Log Manager'), reverse('log_manager:index')),
     ]
Beispiel #13
0
 def __init__(self, **kwargs):
     Menu.__init__(self, **kwargs)
     self.children += [
         items.MenuItem(_('Dashboard'), reverse('admin:index')),
         items.AppList(_('Administration'), ),
         items.MenuItem(_('Sentry'), reverse('sentry')),
         items.MenuItem(_('Go to site'), reverse('main:index')),
         items.MenuItem(_('Forum'), reverse('forum:index')),
     ]
Beispiel #14
0
 def init_with_context(self, context):
     """
     Use this method if you need to access the request context.
     """
     # return super(TestMenu, self).init_with_context(context)
     self.children.append(
         items.MenuItem('Multi Level Items',
                        children=[
                            items.MenuItem('Child 1', '/foo/'),
                            items.MenuItem('Child 2', '/bar/')
                        ]), )
Beispiel #15
0
 def __init__(self, **kwargs):
     Menu.__init__(self, **kwargs)
     self.children.append(items.MenuItem(
         title=u'Main',
         url=reverse('admin:index')
     ))
     self.children.append(items.MenuItem(
         title=u'Web-Site',
         url='/'
     ))
     self.children.append(items.Bookmarks(title=u'Bookmarks'))
Beispiel #16
0
 def __init__(self, **kwargs):
     Menu.__init__(self, **kwargs)
     self.children += [
         items.MenuItem(_('Dashboard'), reverse('admin:index')),
         items.Bookmarks('Закладки',
                         children=[
                             items.MenuItem('Пример 1', '#'),
                             items.MenuItem('Пример 2', '#'),
                         ]),
         items.AppList(_('Applications'), exclude=('django.contrib.*', )),
         items.AppList(_('Administration'), models=('django.contrib.*', ))
     ]
Beispiel #17
0
 def _menu_items(self):
     menu_items = []
     for app in APPS_TO_INCLUDE:
         models = _get_models_registered_in_app(app)
         children = []
         for model_cls in models:
             model_name = model_cls.__name__
             children.append(
                 items.MenuItem(model_name,
                                f'/admin/{app}/{model_name.lower()}/'))
         menu_items.append(items.MenuItem(app, children=children))
     return menu_items
Beispiel #18
0
 def __init__(self, **kwargs):
     Menu.__init__(self, **kwargs)
     self.children += [
         items.MenuItem(_('Home'), reverse('home')),
         items.MenuItem(_('Data'),
                        reverse('geonode.maps.views.search_page')),
         items.MenuItem(_('Maps'), reverse('geonode.maps.views.maps')),
         items.MenuItem(_('Tools'), reverse('cigno.tools.views.index')),
         items.MenuItem(_('Admin'), reverse('admin:index')),
         items.Bookmarks(),
         items.AppList(_('Applications'), exclude=('django.contrib.*', )),
         items.AppList(_('Administration'), models=('django.contrib.*', ))
     ]
Beispiel #19
0
 def __init__(self, **kwargs):
     Menu.__init__(self, **kwargs)
     self.children += [
         items.MenuItem(_('CDR-Stats' + ' V' + cdr_stats.__version__),
                        reverse('admin:index')),
         items.Bookmarks(),
         items.AppList(_('Applications'), exclude=('django.contrib.*', )),
         items.AppList(_('Administration'), models=('django.contrib.*', )),
         items.MenuItem(_('API Explorer'),
                        reverse('admin:index') + '../api-explorer/'),
         items.MenuItem(_('Customer Panel'),
                        reverse('admin:index') + '../'),
     ]
Beispiel #20
0
 def __init__(self, **kwargs):
     Menu.__init__(self, **kwargs)
     self.children += [
         items.MenuItem(
             _('Newfies-Dialer' + ' V' + newfies_dialer.__version__),
             reverse('admin:index')),
         items.Bookmarks(),
         items.AppList(_('Applications'), exclude=('django.contrib.*', )),
         items.AppList(_('Administration'), models=('django.contrib.*', )),
         items.MenuItem(_('API Explorer'),
                        reverse('admin:index') + '../rest-api/'),
         items.MenuItem(_('Customer Panel'),
                        reverse('admin:index') + '../'),
     ]
Beispiel #21
0
 def init_with_context(self, context: RequestContext):
     DefaultMenu.init_with_context(self, context)
     if context.request.user.is_superuser:
         self.children += [
             items.MenuItem(
                 _('Tools'),
                 children=[
                     items.MenuItem(_('Push Console'),
                                    '/%spush_console' % settings.ADMIN_URL),
                     items.MenuItem(
                         _('Red Packet Scheduler'),
                         '/%sred_packet_scheduler' % settings.ADMIN_URL),
                 ]),
         ]
Beispiel #22
0
 def __init__(self, **kwargs):
     Menu.__init__(self, **kwargs)
     self.children += [
         items.MenuItem(_('Dashboard'), reverse('admin:index')),
         items.Bookmarks(),
         items.AppList(_('Administration'),
                       models=(
                           'django.contrib.*',
                           'filer.*',
                       )),
         items.ModelList(
             _('Asset Manager'),
             (
                 'asset_manager.models.Asset',
                 'asset_manager.models.Exchange',
                 'asset_manager.models.Office',
                 'asset_manager.models.Location',
                 'asset_manager.models.Manufacturer',
                 'asset_manager.models.Supplier',
                 'asset_manager.models.Type',
             ),
         ),
         items.ModelList(
             _('License Manager'),
             (
                 'license_manager.models.License',
                 'license_manager.models.LicenseAssignment',
                 'license_manager.models.LicenseSummary',
                 'license_manager.models.Platform',
                 'license_manager.models.SoftwareFamily',
                 'license_manager.models.Software',
                 'license_manager.models.Supplier',
             ),
         ),
     ]
Beispiel #23
0
 def __init__(self, **kwargs):
     Menu.__init__(self, **kwargs)
     self.children += [
         items.MenuItem(_('Dashboard'), reverse('admin:index')),
         items.ModelList(_('Users'), models=self.USERS),
         items.ModelList(_('Structure'),
                         models=('waldur_core.structure.*', )),
         CustomAppList(
             _('Accounting'),
             models=self.ACCOUNTING,
         ),
         CustomAppList(
             _('Providers'),
             models=self.IAAS_CLOUDS,
         ),
         CustomAppList(
             _('Applications'),
             models=self.APPLICATION_PROVIDERS,
         ),
         CustomAppList(
             _('Support'),
             models=self.SUPPORT_MODULES,
         ),
         CustomAppList(_('Utilities'),
                       exclude=(
                           'django.core.*',
                           'django_openid_auth.*',
                           'rest_framework.authtoken.*',
                           'waldur_core.core.*',
                           'waldur_core.structure.*',
                       ) + self.IAAS_CLOUDS + self.APPLICATION_PROVIDERS +
                       self.SUPPORT_MODULES + self.ACCOUNTING + self.USERS),
     ]
Beispiel #24
0
    def __init__(self, **kwargs):
        Menu.__init__(self, **kwargs)
        self.children += [
            items.MenuItem(_('Dashboard'), reverse('admin:index')),
            items.Bookmarks(),

        ]
Beispiel #25
0
 def __init__(self, **kwargs):
     Menu.__init__(self, **kwargs)
     self.children += [
         items.MenuItem(_("Dashboard"), reverse("admin:index")),
         items.Bookmarks(),
         items.AppList(_("Applications")),
     ]
Beispiel #26
0
 def __init__(self, **kwargs):
     Menu.__init__(self, **kwargs)
     self.children += [
         items.MenuItem(_('Dashboard'), reverse('admin:index')),
         CustomAppList(_('Core'),
                       exclude=(
                           'django.core.*',
                           'rest_framework.authtoken.*',
                           'nodeconductor.core.*',
                           'nodeconductor.structure.*',
                       ) + self.IAAS_CLOUDS + self.APPLICATION_PROVIDERS +
                       self.SUPPORT_MODULES),
         items.ModelList(_('Structure'),
                         models=(
                             'nodeconductor.core.*',
                             'nodeconductor_organization.*',
                             'nodeconductor.structure.*',
                         )),
         CustomAppList(
             _('IaaS clouds'),
             models=self.IAAS_CLOUDS,
         ),
         CustomAppList(
             _('Applications'),
             models=self.APPLICATION_PROVIDERS,
         ),
         CustomAppList(
             _('Subscriptions and support'),
             models=self.SUPPORT_MODULES,
         ),
     ]
Beispiel #27
0
    def __init__(self, **kwargs):
        Menu.__init__(self, **kwargs)
        self.children += [
            items.MenuItem(_('Dashboard'), reverse('admin:index')),
        ]

        # Foo
        self.children.append(items.ModelList(_('Foo'), models=conf.foo_apps))

        # News
        self.children.append(items.ModelList(_('News'), models=conf.news_apps))

        # Bookmark
        self.children.append(
            items.ModelList(_('Bookmark'), models=conf.bookmark_apps))

        # Dash
        self.children.append(items.ModelList(_('Dash'), models=conf.dash_apps))

        # Registration
        self.children.append(
            items.ModelList(_('Registration'), models=conf.registration_apps))

        # append an app list module for "Administration"
        self.children.append(
            items.AppList(_('Administration'), models=[
                'django.contrib.*',
            ]))
 def __init__(self, **kwargs):
     Menu.__init__(self, **kwargs)
     self.children += [
         items.MenuItem(_('Dashboard'), reverse('admin:index')),
         items.ModelList(_('Users'), models=self.USERS),
         items.ModelList(_('Structure'),
                         models=('waldur_core.structure.*', )),
         CustomAppList(
             _('Accounting'),
             models=self.ACCOUNTING,
         ),
         CustomAppList(
             _('Providers'),
             models=self.IAAS_CLOUDS,
         ),
         CustomAppList(
             _('Applications'),
             models=self.APPLICATION_PROVIDERS,
         ),
         CustomAppList(
             _('Support'),
             models=self.SUPPORT_MODULES,
         ),
         CustomAppList(_('Utilities'),
                       exclude=flatten(
                           self.EXTRA_MODELS,
                           self.IAAS_CLOUDS,
                           self.APPLICATION_PROVIDERS,
                           self.SUPPORT_MODULES,
                           self.ACCOUNTING,
                           self.USERS,
                       )),
     ]
Beispiel #29
0
 def __init__(self, **kwargs):
     super(PortfolioMenu, self).__init__(**kwargs)
     self.children += [
         items.MenuItem(_('Home'), reverse('admin:index')),
         items.ModelList(
             _('Education'),
             models=[
                 'portfolio.app.courses.*',
                 'portfolio.app.schools.*',
                 'portfolio.app.education.*'
             ],
         ),
         items.ModelList(
             _('Experience'),
             models=[
                 'portfolio.app.companies.*',
                 'portfolio.app.experience.*'
             ],
         ),
         items.ModelList(
             _('Projects & Skills'),
             models=[
                 'portfolio.app.skills.*',
                 'portfolio.app.projects.*'
             ],
         ),
         items.ModelList(
             _('Administration'),
             models=(
                 'django.contrib.*',
                 'portfolio.app.profile.*',
                 'portfolio.app.comments.*'
             ),
         ),
     ]
Beispiel #30
0
 def __init__(self, **kwargs):
     Menu.__init__(self, **kwargs)
     self.children += [
         items.MenuItem(_('Dashboard'), reverse('admin:index')),
         items.Bookmarks(_('Favoritos')),
         items.AppList(_('Applications'),
                       exclude=(
                           'django.contrib.*',
                           'report.models.*',
                           'account.models.*',
                           'emailconfirmation.models.*',
                           'profiles.models.*',
                           'posts.models.*',
                           'elos.models.*',
                           'tagging.models.*',
                       )),
         items.AppList(_('Administration'),
                       models=(
                           'django.contrib.*',
                           'report.models.*',
                           'account.models.*',
                           'emailconfirmation.models.*',
                           'profiles.models.*',
                           'posts.models.*',
                           'elos.models.*',
                           'tagging.models.*',
                       )),
     ]