diff --git a/.idea/CNA340_FinalProject.iml b/.idea/CNA340_FinalProject.iml index 86bd522..a53b939 100644 --- a/.idea/CNA340_FinalProject.iml +++ b/.idea/CNA340_FinalProject.iml @@ -4,10 +4,7 @@ - + - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..3dc583b --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index a31d283..762ee5e 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61919bd..9b4d460 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,8 @@ - + - - - - @@ -213,14 +130,15 @@ - + \ No newline at end of file diff --git a/README.md b/README.md index ac939fa..4d7eea2 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The code requires Python and Flask to run at minimum. Pycharm IDE is recommended ## Running ## 1. Start the server by running main.py -2. Navigate to [localhost:5000](http://localhost:5000) or [127.0.0.1:5000](http://127.0.0.1:5000) in your web browser +2. Navigate to [localhost:5000](http://localhost:5000) or [127.0.0.1:5000](http://127.0.0.1:5000) in your web browser. ## Thanks -Thanks to [Zak](https://github.com/RTCedu) for supplying the initial code. \ No newline at end of file +Thanks to [Zak](https://github.com/RTCedu) for supplying the initial code. diff --git a/main.py b/main.py index 67fb91b..b0c5f5a 100644 --- a/main.py +++ b/main.py @@ -36,13 +36,15 @@ def root(): # Show last product added cur.execute('SELECT productId, name, price, description, image, stock FROM products ORDER BY productId DESC LIMIT 1 ') # Show all items - #cur.execute('SELECT productId, name, price, description, image, stock FROM products LIMIT 1') + + cur.execute('SELECT productId, name, price, description, image, stock FROM products LIMIT 3') + item_data = cur.fetchall() # Show an error instead of the categories category_data = [(-1,"Error")] # Show all categories - #cur.execute('SELECT categoryId, name FROM categories') - #category_data = cur.fetchall() + cur.execute('SELECT categoryId, name FROM categories') + category_data = cur.fetchall() item_data = parse(item_data) return render_template('home.html', itemData=item_data, loggedIn=logged_in, firstName=first_name, noOfItems=no_of_items, categoryData=category_data) @@ -176,10 +178,10 @@ def update_profile(): @app.route("/loginForm") def login_form(): # Uncomment to enable logging in and registration - #if 'email' in session: + if 'email' in session: return redirect(url_for('root')) - #else: - # return render_template('login.html', error='') + else: + return render_template('login.html', error='') @app.route("/login", methods = ['POST', 'GET']) def login():