Example #1
0
def show_category(request, pk, page=1, tmpl="book/category.html"):
    pk = convert_int(pk)
    page = convert_int(page)
    feature_list, object_list, hot_list, paginator, name = handler_show_category(pk, page)
    return render_to_response(
        tmpl,
        context_instance=RequestContext(request, {
            'name': name,
            'hot_list': hot_list,
            'paginator': paginator,
            'object_list': object_list,
            'feature_list': feature_list,
        })
    )
Example #2
0
def show_detail(request, partition, pk, tmpl="book/detail.html"):
    pk = convert_int(pk, exct=True)
    partition = convert_int(partition, exct=True)
    (item, has_next, has_previous,
     next_to, previous_to, recom_list,
     book) = handler_show_detail(partition, pk)
    return render_to_response(
        tmpl,
        context_instance=RequestContext(request, {
            'book': book,
            'object': item,
            'next_to': next_to,
            'has_next': has_next,
            'partition': partition,
            'recom_list': recom_list,
            'previous_to': previous_to,
            'has_previous': has_previous,
        })
    )
Example #3
0
def show_content(request, pk, tmpl="book/content.html"):
    pk = convert_int(pk, exct=True)
    book, object_list, partition, recom_list= handler_show_content(pk)
    book['book__id'] = pk
    return render_to_response(tmpl, context_instance=RequestContext(request, {
        'book': book,
        'object_list': object_list,
        'partition': partition,
        'recom_list': recom_list,
    }))
Example #4
0
def search(request, tmpl="book/search.html"):
    result_list = []
    paginator = None
    keyword = request.GET.get('keyword', '')
    page = request.GET.get('page', 1)
    page = convert_int(page)
    if keyword:
        result_list, paginator, page = handler_search(keyword, page)
    return render_to_response(tmpl, context_instance=RequestContext(request, {
        'result_list': result_list,
        'paginator': paginator
    }))