Untitled

 avatar
unknown
plain_text
2 years ago
456 B
7
Indexable
@app.route('/cart')
@login_required
def cart():
    data = db.cart.get_all()
    total_sum = 0
    for row in data:
        item_row = db.items.get('id', row.item_id)
        row.name = item_row.name
        row.description = item_row.description
        row.price = item_row.price
        row.total = row.amount * item_row.price
        total_sum += row.total
        
    return render_template('cart.html', data=data, total_sum=total_sum)
Editor is loading...