Exemple #1
0
def book_category(category, level):
    # level = request.args.get('level')
    if category == 'teach_book':
        book_list = Book.query.filter(Book.publish == True,
                                      Book.category == u'幼教教材')
        if level:
            book_list = book_list.filter(Book.level == level)
        book_list = book_list.limit(8)
        top10 = Book.top10()
        return render_template('book/sub_node.html',
                               book_list=book_list,
                               top10=top10,
                               level=level,
                               slider=Slider.book_slider(),
                               category=category)

    elif category == 'read_book':
        book_list = Book.query.filter(Book.publish == True,
                                      Book.category == u'幼教读物')
        if level:
            book_list = book_list.filter(Book.level == level)
        book_list = book_list.limit(8)
        return render_template('book/sub_node.html',
                               book_list=book_list,
                               level=level,
                               slider=Slider.book_slider(),
                               category=category)
    else:
        abort(404)
Exemple #2
0
def book_category(category, level):
    # level = request.args.get('level')
    if category == "teach_book":
        book_list = Book.query.filter(Book.publish == True, Book.category == u"幼教教材")
        if level:
            book_list = book_list.filter(Book.level == level)
        book_list = book_list.limit(8)
        top10 = Book.top10()
        return render_template(
            "book/sub_node.html",
            book_list=book_list,
            top10=top10,
            level=level,
            slider=Slider.book_slider(),
            category=category,
        )

    elif category == "read_book":
        book_list = Book.query.filter(Book.publish == True, Book.category == u"幼教读物")
        if level:
            book_list = book_list.filter(Book.level == level)
        book_list = book_list.limit(8)
        return render_template(
            "book/sub_node.html", book_list=book_list, level=level, slider=Slider.book_slider(), category=category
        )
    else:
        abort(404)
Exemple #3
0
def book():
    teach_book_list = Book.query.filter(
        and_(Book.category == u'幼教教材', Book.publish == True)).limit(9)
    read_book_list = Book.query.filter_by(category=u'幼教读物').limit(9)
    # import ipdb; ipdb.set_trace()
    return render_template('book/home.html', teach_book_list=teach_book_list,
                           read_book_list=read_book_list, Book=Book,
                           slider=Slider.book_slider())
Exemple #4
0
def book():
    teach_book_list = Book.query.filter(
        and_(Book.category == u'幼教教材', Book.publish == True)).limit(9)
    read_book_list = Book.query.filter_by(category=u'幼教读物').limit(9)
    # import ipdb; ipdb.set_trace()
    return render_template('book/home.html',
                           teach_book_list=teach_book_list,
                           read_book_list=read_book_list,
                           Book=Book,
                           slider=Slider.book_slider())
Exemple #5
0
def book_category(category):
    level = request.args.get('level')
    if category == 'teach_book':
        book_list = Book.query.filter(Book.publish==True, Book.category==u'幼教教材')
        if level:
            book_list = book_list.filter(Book.level==level)
        book_list = book_list.limit(8)
        top10 = Book.top10()
        return render_template('book/sub_node.html', book_list=book_list, top10=top10,
                               level=level, slider=Slider.book_slider())

    elif category == 'read_book':
        book_list = Book.query.filter(Book.publish==True, Book.category==u'幼教读物')
        if level:
            book_list = book_list.filter(Book.level==level)
        book_list = book_list.limit(8)
        return render_template('book/sub_node.html', book_list=book_list, level=level,
                               slider=Slider.book_slider())
    else:
        abort(404)