예제 #1
0
파일: views.py 프로젝트: degacth/natshop
    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
예제 #2
0
파일: views.py 프로젝트: degacth/natshop
    def get_context_data(self, **kwargs):
        section = Section(**{
            'title': u'Кабинет клиента',
        })

        return get_default_context(section)
예제 #3
0
파일: views.py 프로젝트: degacth/natshop
 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
예제 #4
0
파일: views.py 프로젝트: degacth/natshop
 def get_context_data(self, **kwargs):
     self.template_name = kwargs['template_name']
     return views.get_default_context(kwargs['section'])
예제 #5
0
파일: views.py 프로젝트: degacth/natshop
 def get_context_data(self, **kwargs):
     return views.get_default_context(kwargs['section'])