示例#1
0
 def get_nodes(self, request):
     nodes = []
     tag_menu_id = 'blog-tag-list'
     attributes = {'hidden': HIDE_TAGS_MENU}
     nodes.append(NavigationNode(
         _('Tags'),
         reverse(
             'aldryn_blog:tag-list'
         ),
         tag_menu_id,
         attr=attributes
     ))
     posts = Post.published.filter_by_current_language()
     tags = TaggedUnicodeItem.objects.none()
     for post in posts:
         tags = tags | TaggedUnicodeItem.tags_for(
             Post, post).order_by("name")
     for tag in tags:
         node = NavigationNode(
             tag.name,
             reverse(
                 'aldryn_blog:tagged-posts',
                 kwargs={'tag': tag.slug}
             ),
             tag.pk,
             tag_menu_id,
             attr=attributes
         )
         nodes.append(node)
     return nodes
示例#2
0
 def get_nodes(self, request):
     nodes = []
     posts = Post.published.filter_by_current_language()
     tags = TaggedUnicodeItem.objects.none()
     for post in posts:
         tags = tags | TaggedUnicodeItem.tags_for(Post, post).order_by("name")
     for tag in tags:
         node = NavigationNode(
             tag.name,
             reverse(
                 'aldryn_blog:tagged-posts', kwargs={'tag': tag.slug}),
             tag.pk
         )
         nodes.append(node)
     return nodes
示例#3
0
 def get_nodes(self, request):
     nodes = []
     tag_menu_id = 'blog-tag-list'
     attributes = {'hidden': HIDE_TAGS_MENU}
     nodes.append(
         NavigationNode(_('Tags'),
                        reverse('aldryn_blog:tag-list'),
                        tag_menu_id,
                        attr=attributes))
     posts = Post.published.filter_by_current_language()
     tags = TaggedUnicodeItem.objects.none()
     for post in posts:
         tags = tags | TaggedUnicodeItem.tags_for(Post,
                                                  post).order_by("name")
     for tag in tags:
         node = NavigationNode(tag.name,
                               reverse('aldryn_blog:tagged-posts',
                                       kwargs={'tag': tag.slug}),
                               tag.pk,
                               tag_menu_id,
                               attr=attributes)
         nodes.append(node)
     return nodes