Skip to content
Open
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
8 changes: 4 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ 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 4 ')
# Show all items
#cur.execute('SELECT productId, name, price, description, image, stock FROM products LIMIT 1')
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)

# Part of function was made into a comment.
@app.route("/add")
def admin():
with sqlite3.connect('database.db') as conn:
Expand Down