コード例 #1
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
        })
コード例 #2
0
ファイル: views.py プロジェクト: webadmin87/midnight
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
        })
コード例 #3
0
ファイル: views.py プロジェクト: nanson/midnight
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
                   }
                  )
コード例 #4
0
ファイル: views.py プロジェクト: nanson/midnight
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})