Exemple #1
0
def pending():
    drifts = Drift.user_drifts()
    drifts_view = DriftCollection()
    drifts_view.fill(drifts)
    return render_template('pending.html',
                           total=drifts_view.total,
                           drifts=drifts_view.drifts)
Exemple #2
0
def pending():
    drifts = Drift.query.filter(
        or_(Drift.requester_id == current_user.id,
            Drift.gifter_id == current_user.id)).order_by(
                desc(Drift.create_time)).all()
    views = DriftCollection(drifts, current_user.id)
    return render_template('pending.html', drifts=views.data)
Exemple #3
0
def pending():
    # 点击鱼漂时跳转
    # 交易记录--查询drift表---1.我作为索要者的交易 或者  2.我作为赠送者的交易
    drifts = Drift.query.filter(
        or_(Drift.requester_id == current_user.id,
            Drift.gifter_id == current_user.id)).order_by(desc(Drift.create_time)).all()
    # 没有在DriftCollection这个模型中直接写入cuurent_user,保证了模型的完整性,不会被current_user所束缚
    views = DriftCollection(drifts, current_user.id)
    return render_template('pending.html', drifts=views.data)
Exemple #4
0
def pending():
    '''处理时光漂流页面。'''
    # 查询自己身为请求者或赠送者的交易信息
    drifts = Drift.query.filter(
        or_(Drift.requester_id == current_user.id,
            Drift.gifter_id == current_user.id)).order_by(
                desc(Drift.create_time)).all()

    view_model = DriftCollection(drifts, current_user.id)
    return render_template('web/pending.html', drifts=view_model.data)
Exemple #5
0
def pending():
    # 我赠送的或者我索要的书籍列表
    drifts = Drift.query.filter(
        or_(Drift.requester_id == current_user.id,
            Drift.gifter_id == current_user.id)).order_by(
                desc(Drift.create_time)).all()

    # 将数据封装到数据模型中后, 传递给前端
    views = DriftCollection(drifts, current_user.id)
    return render_template('pending.html', drifts=views.data)
Exemple #6
0
def pending():
    #   or_表示或的关系
    #   作为一个用户,你既可以送书也可以要书,那么在交易记录中,既可能是requester也可能是gifter
    #   所以这里用或的关系查找
    drifts = Drift.query.filter(
        or_(Drift.requester_id == current_user.id,
            Drift.gifter_id == current_user.id)).order_by(
                desc(Drift.create_time)).all()
    view = DriftCollection(drifts)
    return render_template('pending.html', drifts=view.data)
Exemple #7
0
def pending():
    """
    显示交易记录 我作为赠送者 or 我作为请求者
    使用or_() 进行or关系的转化
    :return:
    """
    drifts = Drift.query.filter(
        or_(Drift.requester_id == current_user.id, Drift.gifter_id == current_user.id)).order_by(
        desc(Drift.create_time)).all()

    views = DriftCollection(drifts, current_user.id)
    return render_template('pending.html', drifts=views.data)
Exemple #8
0
def pending():
    """
    requester_id和gifter_id之间是或关系,
    筛选出来的记录才是作为赠送者或者是请求人.
    方法:使用filter结合or_,or括号里面的条件就是或关系
    :return:
    """
    drifts = Drift.query.filter(
        or_(Drift.requester_id == current_user.id,
            Drift.gifter_id == current_user.id)).order_by(
                desc(Drift.create_time)).all()

    views = DriftCollection(drifts, current_user.id)
    return render_template('pending.html', drifts=views.data)