コード例 #1
0
ファイル: main.py プロジェクト: stefine/Fisher
def index():
    recent = Gift.recent()
    yushu_book = Yushubook()
    for r in recent:
        yushu_book.search_by_isbn(r.isbn)
    result = BookViewModel.collection(data=yushu_book)
    return render_template('index.html', recent=result['books'])
コード例 #2
0
ファイル: main.py プロジェクト: atraraxia/sharebook
def index():
    recent_gifts = Gift.recent()
    books = []
    for gift in recent_gifts:
        book = Book.query.filter_by(isbn=gift.isbn).first()
        books.append(book)
    return render_template('index.html', recent=books)
コード例 #3
0
ファイル: main.py プロジェクト: Done4/Second-hand
def index():
    recent_gifts = Gift.recent()
    books = [BookViewModelSQL(gift.book) for gift in recent_gifts]
    '''
    显示热门书
    统计 wish表未完成的书籍和drift表已完成和待完成的书籍 作为 热门书籍
    '''
    sql = 'select sum(ci),isbn ' \
          'from (' \
          '(select count(drift.isbn) as ci , isbn from drift ' \
          'where pending = 2 or pending = 1 group by isbn) union' \
          '(select count(wish.isbn), isbn from wish where ' \
          'launched = 0 group by isbn )' \
          ') as tall group by isbn order by ci desc limit 6'
    row = db.session.execute(sql)
    hotbooks = [
        Book.query.filter(Book.isbn == isbn[1]).all()
        for isbn in row.fetchall()
    ]
    #判断用户是否登录,如有用户登录为他进行个性化推荐
    if current_user.is_authenticated:
        items = ItemBasedCF()
        result = items.recommend(current_user.id)
        #推荐结果不为空就替代热门书籍显示
        if result:
            hotbooks = [
                Book.query.filter(Book.isbn == r[0]).all() for r in result
            ]
    return render_template('index.html', recent=books, hotbooks=hotbooks)
コード例 #4
0
ファイル: main.py プロジェクト: tanglang1990/yushu
def index():
    # 此处由于书本信息本身会去调用豆瓣的api,加上频繁的访问
    # 可以考虑将将api的结果缓存起来,可以使用 Flask-Cache
    # 官方文档: http://www.pythondoc.com/flask-cache/index.html
    recent_gifts = Gift.recent()
    books = [gift.book for gift in recent_gifts]
    return render_template('index.html', recent=books)
コード例 #5
0
def index():
    """
        首页视图函数
    """
    recent_gifts = Gift.recent()
    books = [BookViewModel(gift.book) for gift in recent_gifts]
    return render_template('index.html', recent=books)
コード例 #6
0
def index():
    """
        首页视图函数
        这里使用了缓存,注意缓存必须是贴近index函数的
    """
    gift_list = Gift.recent()
    books = [BookViewModel(gift.book) for gift in gift_list]
    return render_template('index.html', recent=books)
コード例 #7
0
ファイル: main.py プロジェクト: yujunje11526061/LearnFlask
def index():
    '''
    主页放最近添加且还在架的礼物
    :return:
    '''
    recent_gifts = Gift.recent()
    book_list = [BookViewModel(gift.book) for gift in recent_gifts]
    return render_template("index.html", recent=book_list)
コード例 #8
0
def index():
    books = Gift.recent()
    recent = [BookViewModel(book) for book in books]
    return render_template('index.html', recent=recent)


# 1,最近30条
# 2,倒序
# 3,去重
# 4,礼物表,book表
コード例 #9
0
def index():
    """
        首页视图函数
        这里使用了缓存,注意缓存必须是贴近index函数的
    """
    # gift_list = GiftService.recent()	# 不推荐用service
    recent_gifts = Gift.recent()
    books = [BookViewModel(gift.book.first) for gift in recent_gifts]

    # return render_template('index.html', recent=gift_list)
    return render_template('index.html', recent=books)
コード例 #10
0
def index():
    pass

    recent_gifts = Gift.recent()

    books = [BookViewModel(gift.book) for gift in recent_gifts]

    # for g in recent_gifts:
    #     print(g)

    return render_template('index.html', recent=books)
コード例 #11
0
def index():
    recent_gifts = Gift.recent()
    # user = User()
    # user.email = "*****@*****.**"
    # user.password = "******"
    # user.nickname = "258"
    # db.session.add(user)
    # db.session.commit()
    books = [BookViewModel(gift.book) for gift in recent_gifts]

    return render_template('index.html', recent=books)
コード例 #12
0
ファイル: main.py プロジェクト: ttkltll/fisher_review
def index():
    """
    怎么显示最近上传?上传的都是一些每个作者能赠送的书
    拿到所有礼物的数据
    如何把拿到的wishes转换成书籍的格式?

    :return:
    """
    recent_gifts = Gift.recent()  #拿到所有符合条件的礼物,比如不重复。这个事,一个类方法可以实现
    books = [BookViewModel(gift.book) for gift in recent_gifts]
    return render_template('index.html', recent=books)
コード例 #13
0
ファイル: main.py プロジェクト: jefflike/flask_project
def index():
    books = [BookViewModel(gift.isbn_book) for gift in Gift.recent()]
    return render_template('index.html', recent=books)
コード例 #14
0
ファイル: main.py プロジェクト: liufazhan/fishshop
def index():
    # 获取上传的书籍数据
    recent_gifts = Gift.recent()
    # 获取的上传的书籍礼物是以书籍数据展示的,如何获取书籍的数据可以使用书籍礼物列表中的书籍的isbn编号
    books = [BookViewModel(gift.book) for gift in recent_gifts]
    return render_template('index.html', recent=books)
コード例 #15
0
ファイル: main.py プロジェクト: Cherish-sun/fisher
def index():
    recent_gift = Gift.recent()
    books = [BookViewModel(gift.get_book) for gift in recent_gift]
    return render_template('index.html', recent=books)
コード例 #16
0
ファイル: main.py プロジェクト: superdicdi/fisher
def index():
    recent_gifts = Gift.recent()
    recent_gifts = [gift.book for gift in recent_gifts]
    return render_template("index.html", recent=recent_gifts)
コード例 #17
0
ファイル: main.py プロジェクト: yuansuixin/Fisher
def index():
    recent_gifts = Gift.recent()
    books = [BookViewModel(gift.book) for gift in recent_gifts]
    return 'hello'
コード例 #18
0
ファイル: main.py プロジェクト: ZTT001/learngit
def index():
    recent_gifts = Gift.recent()
    books = [BookViewModel(gift.book) for gift in recent_gifts]
    return render_template('index,html', recent=books)
コード例 #19
0
def index():
    recent_gifts = Gift.recent()
    books = [Book_viewmodel(gift.book) for gift in recent_gifts]
    return render_template('index.html', recent=books)
コード例 #20
0
def index():
    recent_gifts = Gift.recent()
    books = [Book(Book.get_book_byisbn(gift.isbn)) for gift in recent_gifts]
    return render_template('index.html', recent=books)
コード例 #21
0
def index():
    '''处理最近上传页面。'''
    recent_gifts = Gift.recent()
    books = [BookViewModel(gift.book) for gift in recent_gifts]
    return render_template('web/index.html', recent=books)
コード例 #22
0
ファイル: main.py プロジェクト: kosmosr/fisher_flask
def index():
    recent_gifts = Gift.recent()
    schema = BookSchema(only=('title', 'summary', 'author', 'isbn', 'image'))
    recent = [schema.dump(gift.book).data for gift in recent_gifts]
    return SuccessResponse(data=recent)()
コード例 #23
0
ファイル: main.py プロジェクト: xzfd1010/python-YushuBook
def index():
    recent_gifts = Gift.recent()  # 需要把礼物作为书籍显示出来
    # 模型只负责处理原始数据
    books = [BookViewModel(gift.book) for gift in recent_gifts]
    return render_template('index.html', recent=books)
コード例 #24
0
ファイル: main.py プロジェクト: Tan2475/yushu
def index():
    recent = Gift.recent()
    gifts = [BookViewModel(gift.book) for gift in recent]
    return render_template('index.html', recent=gifts)
コード例 #25
0
def index():
    gift_lists = Gift.recent()
    print('-----gift_lists---', gift_lists)
    books = [BookViewModel(gift.book) for gift in gift_lists]
    return render_template('index.html', recent=books)
コード例 #26
0
ファイル: main.py プロジェクト: Annihilater/fisher
def index():
    recent_gifts = Gift.recent()
    books = [BookViewModel(gift.book) for gift in recent_gifts]
    return render_template("index.html", recent=books)
コード例 #27
0
ファイル: main.py プロジェクト: yekingyan/fish_book
def index():
    recent_gifts = Gift.recent(30)
    books = [BookViewModel.cut_book_detail(i.book) for i in recent_gifts]
    return template_or_json(request, 'index.html', books, recent=books)