Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
from main import app
from flask import Flask,redirect,url_for,render_template,abort,request,abort,make_response,session,g,flash
import sqlite3
from werkzeug.utils import secure_filename
import os
@app.route('/shopping_cart', methods = ['GET','POST'])
def shopping_cart():
if request.method == 'POST':
if request.form['Submit'] == 'GO TO HOME': #when the GO TO HOME button is pressed redirect to the homepage
return redirect(url_for('homepage'))
elif request.form['Submit'] == 'CANCEL' or request.form['Submit'] == 'PAY NOW':
#we want to clear everything from a session except logged_in, so we store it inside a variable, in order to add it after clearing it
remember = session['logged_in']
session.clear()
session['logged_in'] = remember
return redirect(url_for('homepage'))
elif request.form['Submit'] == 'ADD STOCK': #when the ADD STOCK is pressed redirect to the the add book form
return redirect(url_for('add_stock'))
elif request.form['Submit'] == 'GO TO CART': #when the GO TO CART button is pressed redirect to the shopping cart
return render_template('shopping_cart.html')
elif request.form['Submit'] == 'CHECKOUT': #when the CHECKOUT button is pressed redirect to the checkout
return render_template('checkout.html')
else:
return render_template('shopping_cart.html')