Exemplo n.º 1
0
    def get_context_data(self, **kwargs):
        section = kwargs['section']
        obj_id = kwargs['obj_id']

        # Article
        if obj_id:
            self.template_name = "blog_item.html"
            context = views.get_default_context(shortcuts.get_object_or_404(models.Article, pk=obj_id))
            context['last_articles'] = models.Article.objs.all().exclude(id=obj_id)\
                .select_related().prefetch_related('attachments')[:3]
            return context

        # Section
        self.template_name = "blog_list.html"
        context = views.get_default_context(section)
        context['articles'] = views.get_paginator(section.get_articles())

        return context
Exemplo n.º 2
0
    def get_context_data(self, **kwargs):
        section = Section(**{
            'title': u'Кабинет клиента',
        })

        return get_default_context(section)
Exemplo n.º 3
0
 def get_context_data(self, **kwargs):
     section = kwargs['section']
     context = views.get_default_context(section)
     context['products'] = views.get_paginator(models.Product.get_by_category_name(section.name))
     return context
Exemplo n.º 4
0
 def get_context_data(self, **kwargs):
     self.template_name = kwargs['template_name']
     return views.get_default_context(kwargs['section'])
Exemplo n.º 5
0
 def get_context_data(self, **kwargs):
     return views.get_default_context(kwargs['section'])