Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added __pycache__/main.cpython-312.pyc
Binary file not shown.
Binary file modified database.db
Binary file not shown.
14 changes: 7 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ def root():
with sqlite3.connect('database.db') as conn:
cur = conn.cursor()
# Show last product added
cur.execute('SELECT productId, name, price, description, image, stock FROM products ORDER BY productId DESC LIMIT 1 ')
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 ')
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') # hashtag in front of line removed by Tyler Sabin 11/16/2023
category_data = cur.fetchall() # hashtag in front of line removed by Tyler Sabin 11/16/2023
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)

Expand Down Expand Up @@ -176,10 +176,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: #Uncommented by Yeab 1/18/2023
return redirect(url_for('root'))
#else:
# return render_template('login.html', error='')
else: #Uncommented by Yeab 1/18/2023
return render_template('login.html', error='') #Uncommented by Yeab 1/18/2023

@app.route("/login", methods = ['POST', 'GET'])
def login():
Expand Down
4 changes: 2 additions & 2 deletions templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ <h2>Items</h2>
</td>
{% endfor %}
</tr>
<!--
<!--
<tr id="productPrice">
{% for row in data %}
<td>
Expand All @@ -71,7 +71,7 @@ <h2>Items</h2>
{% endfor %}
</tr>

-->
-->
<tr id = "">
{%for row in data%}
<!-- <td><input type="text" size="10"/></td> -->
Expand Down