Пример #1
0
def book_detail(request, slug):
    try:
        book = models.Book.objects.get(slug=slug)
    except models.Book.DoesNotExist:
        return pdcounter_views.book_stub_detail(request, slug)

    book_tag = book.book_tag()
    tags = list(book.tags.filter(~Q(category='set')))
    categories = split_tags(tags)
    book_children = book.children.all().order_by('parent_number', 'title')
    
    _book = book
    parents = []
    while _book.parent:
        parents.append(_book.parent)
        _book = _book.parent
    parents = reversed(parents)

    theme_counter = book.theme_counter
    book_themes = models.Tag.objects.filter(pk__in=theme_counter.keys())
    for tag in book_themes:
        tag.count = theme_counter[tag.pk]

    extra_info = book.get_extra_info_value()

    form = forms.SearchForm()
    return render_to_response('catalogue/book_detail.html', locals(),
        context_instance=RequestContext(request))
Пример #2
0
def book_detail(request, slug):
    try:
        book = models.Book.objects.get(slug=slug)
    except models.Book.DoesNotExist:
        return pdcounter_views.book_stub_detail(request, slug)

    book_children = book.children.all().order_by('parent_number', 'sort_key')
    return render_to_response('catalogue/book_detail.html', locals(),
        context_instance=RequestContext(request))
Пример #3
0
def book_detail(request, slug):
    try:
        book = models.Book.objects.get(slug=slug)
    except models.Book.DoesNotExist:
        return pdcounter_views.book_stub_detail(request, slug)

    book_children = book.children.all().order_by('parent_number', 'sort_key')
    return render_to_response('catalogue/book_detail.html', locals(),
        context_instance=RequestContext(request))
Пример #4
0
def book_detail(request, slug):
    try:
        book = Book.objects.get(slug=slug)
    except Book.DoesNotExist:
        return pdcounter_views.book_stub_detail(request, slug)

    return render_to_response('catalogue/book_detail.html', {
        'book': book,
        'tags': book.tags.exclude(category__in=('set', 'theme')),
        'book_children': book.children.all().order_by('parent_number', 'sort_key'),
        'active_menu_item': 'books',
    }, context_instance=RequestContext(request))
Пример #5
0
def book_detail(request, slug):
    try:
        book = Book.objects.get(slug=slug)
    except Book.DoesNotExist:
        return pdcounter_views.book_stub_detail(request, slug)

    return render(
        request,
        'catalogue/book_detail.html',
        {
            'book': book,
            'book_children': book.children.all().order_by('parent_number', 'sort_key'),
            'active_menu_item': 'books',
        })
Пример #6
0
def book_detail(request, slug):
    try:
        book = Book.objects.get(slug=slug)
    except Book.DoesNotExist:
        return pdcounter_views.book_stub_detail(request, slug)

    return render_to_response('catalogue/book_detail.html', {
        'book':
        book,
        'tags':
        book.tags.exclude(category__in=('set', 'theme')),
        'book_children':
        book.children.all().order_by('parent_number', 'sort_key'),
        'active_menu_item':
        'books',
    },
                              context_instance=RequestContext(request))