Example #1
0
def detail(request, section_slug, slug):

    item = get_one(slug)

    if not item:
        raise Http404('Item with slug "%s" not found' % slug)

    section = get_object_or_404(Section, slug=section_slug, active=True)

    crumbs = [{
        'label': _('Catalog'),
        'url': reverse('midnight_catalog:catalog_list')
    }] + section.get_breadcrumbs(True) + [{
        'label': item.title
    }]

    text = Template(item.text).render(Context())

    meta = MetaSeo(item)

    comments = get_object_comments(ProductComment, item.id)

    comments_form = ProductCommentForm(initial=get_comment_init(request, item))

    return render(
        request, 'midnight_catalog/catalog/detail.html', {
            'item': item,
            'text': text,
            'meta': meta,
            'crumbs': crumbs,
            'comments': comments,
            'comments_form': comments_form
        })
Example #2
0
def detail(request, section_slug, slug):

    item = get_object_or_404(News, slug=slug, active=True)

    section = get_object_or_404(Section, slug=section_slug, active=True)

    crumbs = section.get_breadcrumbs(True) + [{'label': item.title}]

    text = Template(item.text).render(Context())

    meta = MetaSeo(item)

    comments = get_object_comments(NewsComment, item.id)

    comments_form = NewsCommentForm(initial=get_comment_init(request, item))

    return render(
        request, 'midnight_news/news/detail.html', {
            'item': item,
            'text': text,
            'meta': meta,
            'crumbs': crumbs,
            'comments': comments,
            'comments_form': comments_form
        })
Example #3
0
def detail(request, section_slug, slug):

    item = get_one(slug)

    if not item:
        raise Http404('Item with slug "%s" not found' % slug)

    section = get_object_or_404(Section, slug=section_slug, active=True)

    crumbs = [{'label': _('Catalog'), 'url': reverse('midnight_catalog:catalog_list')}] + section.get_breadcrumbs(True) + [{'label': item.title}]

    text = Template(item.text).render(Context())

    meta = MetaSeo(item)

    comments = get_object_comments(ProductComment, item.id)

    comments_form = ProductCommentForm(initial=get_comment_init(request, item))

    return render(request, 'midnight_catalog/catalog/detail.html',
                  {'item': item,
                   'text': text,
                   'meta': meta,
                   'crumbs': crumbs,
                   'comments': comments,
                   'comments_form': comments_form
                   }
                  )
Example #4
0
def detail(request, section_slug, slug):

    item = get_object_or_404(News, slug=slug, active=True)

    section = get_object_or_404(Section, slug=section_slug, active=True)

    crumbs = section.get_breadcrumbs(True) + [{'label': item.title}]

    text = Template(item.text).render(Context())

    meta = MetaSeo(item)

    comments = get_object_comments(NewsComment, item.id)

    comments_form = NewsCommentForm(initial=get_comment_init(request, item))

    return render(request, 'midnight_news/news/detail.html', {'item': item, 'text': text, 'meta': meta, 'crumbs': crumbs, 'comments': comments, 'comments_form': comments_form})
Example #5
0
 def get(self, request):
     comments = get_object_comments(self.model_cls,
                                    request.GET.get('id', 0))
     return render(request, self.list_tpl, {'comments': comments})
Example #6
0
 def get(self, request):
     comments = get_object_comments(self.model_cls, request.GET.get('id', 0))
     return render(request, self.list_tpl, {'comments': comments})