diff --git a/main.py b/main.py index 2026c1a..cbe3814 100755 --- a/main.py +++ b/main.py @@ -12,7 +12,7 @@ def createDB(): conn = sqlite3.connect('list.db') c = conn.cursor() c.execute('''CREATE TABLE LIST ( - requester text, item text, quatity real, gotten real)''') + requester text, item text, quatity integer, gotten text)''') conn.close() @@ -31,6 +31,11 @@ def getData(): def updateDB(req): + for item in req: + for value in item: + if value == "": + print("Null Detected Boi") + return with sqlite3.connect('list.db') as conn: c = conn.cursor() print(req) @@ -46,7 +51,7 @@ app.config['DEBUG'] = True def index(): if request.method == 'POST': req = [(request.form['requester'], request.form['item'], - request.form['quantity'], request.form['gotten'])] + request.form['quantity'], "False")] updateDB(req) data = getData() return render_template('index.html', data=data) @@ -60,4 +65,4 @@ if __name__ == '__main__': #ret = c.execute("SELECT * from LIST WHERE requester = 'Tim'") #print(ret.fetchall()) - app.run() + app.run(host='0.0.0.0') diff --git a/static/css/table.css b/static/css/table.css new file mode 100644 index 0000000..6983304 --- /dev/null +++ b/static/css/table.css @@ -0,0 +1,12 @@ +table { + font-family: arial, sans-serif; + border-collapse: collapse; + +} + +td, th { + + text-align: left; + padding: 8px; +} + diff --git a/templates/index.html b/templates/index.html index 4807f39..068d30c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,24 +1,44 @@ - + + + +

Shopping list

- + + + + + + + {% for res in data %} + {% for field in res %} + {% endfor %} -
+ {% endfor %} +
RequesterItemQuantityGot It?
{{ field }} +
+ - -
- -
- -
- -
- + + + + + + + + + + + + + + + - +



\ No newline at end of file