Exemplo n.º 1
0
    def get_context_data(self, **kwargs):
        context = super(ArticleList, self).get_context_data(**kwargs)

        if self.section:
            context['section'] = SECTION_MAP[self.section]
            context['active_nav'] = SECTION_MAP[self.section]['slug']
            context['rss_link'] = reverse('article_list_by_section_feed',
                                          kwargs={'section': self.section})
        elif self.category:
            context['category'] = CATEGORY_MAP[self.category]['name']
            context['section'] = SECTION_MAP[CATEGORY_MAP[self.category]
                                             ['parent_slug']]
            context['active_nav'] = CATEGORY_MAP[self.category]['parent_slug']
            context['rss_link'] = reverse('article_list_by_category_feed',
                                          kwargs={'category': self.category})
        elif self.tag:
            context['section'] = SECTION_MAP['articles']
            context['active_nav'] = SECTION_MAP['articles']['slug']
            context['tag'] = self.tag
            context['rss_link'] = reverse('article_list_by_tag_feed',
                                          kwargs={'tag_slug': self.tag_slug})
        else:
            context['rss_link'] = reverse('homepage_feed')

        page, paginator = paginate(self.request, self.object_list, 20)
        context.update({'page': page, 'paginator': paginator})

        return context
Exemplo n.º 2
0
 def paginate_list(self, context):
     page, paginator = paginate(self.request, self.object_list, 20)
     context.update({
         'page': page,
         'paginator': paginator
     })
     
     return ''
Exemplo n.º 3
0
    def get_context_data(self, **kwargs):
        context = super(CodeList, self).get_context_data(**kwargs)
        context['active_nav'] = 'Code'

        if self.tag:
            context['tag'] = self.tag
            context['rss_link'] = reverse('code_list_by_tag_feed',
                                          kwargs={'tag_slug': self.tag_slug})
        else:
            context['rss_link'] = reverse('code_list_feed')

        page, paginator = paginate(self.request, self.object_list, 50)
        context.update({'page': page, 'paginator': paginator})

        return context
Exemplo n.º 4
0
    def get_context_data(self, **kwargs):
        context = super(CodeList, self).get_context_data(**kwargs)
        context['active_nav'] = 'Code'

        if self.tag:
            context['tag'] = self.tag
            context['rss_link'] = reverse('code_list_by_tag_feed', kwargs={'tag_slug': self.tag_slug})
        else:
            context['rss_link'] = reverse('code_list_feed')
        
        page, paginator = paginate(self.request, self.object_list, 50)
        context.update({
            'page': page,
            'paginator': paginator
        })

        return context
Exemplo n.º 5
0
    def paginate_list(self, context):
        page, paginator = paginate(self.request, self.object_list, 20)
        context.update({'page': page, 'paginator': paginator})

        return ''