You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.6 KiB
49 lines
1.6 KiB
# # -*- coding: utf-8 -*-
|
|
|
|
# from __future__ import unicode_literals
|
|
|
|
# from django.utils.translation import (
|
|
# get_language_from_request,
|
|
# ugettext_lazy as _,
|
|
# )
|
|
|
|
# from cms.menu_bases import CMSAttachMenu
|
|
# from cms.apphook_pool import apphook_pool
|
|
# from menus.base import NavigationNode
|
|
# from menus.menu_pool import menu_pool
|
|
|
|
# from .models import BlogCategory
|
|
|
|
|
|
# class BlogMenu(CMSAttachMenu):
|
|
# name = _('Blog Menu')
|
|
|
|
# def get_queryset(self, request):
|
|
# """Returns base queryset with support for preview-mode."""
|
|
# queryset = BlogCategory.objects.all()
|
|
# # if not (request.toolbar and request.toolbar.edit_mode):
|
|
# # queryset = queryset.published()
|
|
# return queryset
|
|
|
|
# def get_nodes(self, request):
|
|
# nodes = []
|
|
# language = get_language_from_request(request, check_path=True)
|
|
# articles = self.get_queryset(request).active_translations(language)
|
|
|
|
# # if hasattr(self, 'instance') and self.instance:
|
|
# # app = apphook_pool.get_apphook(self.instance.application_urls)
|
|
# # config = app.get_config(self.instance.application_namespace)
|
|
# # if config:
|
|
# articles = articles.all()
|
|
|
|
# for article in articles:
|
|
# node = NavigationNode(
|
|
# article.safe_translation_getter('name',
|
|
# language_code=language),
|
|
# article.get_absolute_url(),
|
|
# article.pk,
|
|
# )
|
|
# nodes.append(node)
|
|
# return nodes
|
|
|
|
# menu_pool.register_menu(BlogMenu)
|
|
|