Made it look more prettier
This commit is contained in:
parent
59a6e45cf2
commit
ad00608c41
11
main.py
11
main.py
@ -12,7 +12,7 @@ def createDB():
|
|||||||
conn = sqlite3.connect('list.db')
|
conn = sqlite3.connect('list.db')
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
c.execute('''CREATE TABLE LIST (
|
c.execute('''CREATE TABLE LIST (
|
||||||
requester text, item text, quatity real, gotten real)''')
|
requester text, item text, quatity integer, gotten text)''')
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
|
||||||
@ -31,6 +31,11 @@ def getData():
|
|||||||
|
|
||||||
|
|
||||||
def updateDB(req):
|
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:
|
with sqlite3.connect('list.db') as conn:
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
print(req)
|
print(req)
|
||||||
@ -46,7 +51,7 @@ app.config['DEBUG'] = True
|
|||||||
def index():
|
def index():
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
req = [(request.form['requester'], request.form['item'],
|
req = [(request.form['requester'], request.form['item'],
|
||||||
request.form['quantity'], request.form['gotten'])]
|
request.form['quantity'], "False")]
|
||||||
updateDB(req)
|
updateDB(req)
|
||||||
data = getData()
|
data = getData()
|
||||||
return render_template('index.html', data=data)
|
return render_template('index.html', data=data)
|
||||||
@ -60,4 +65,4 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
#ret = c.execute("SELECT * from LIST WHERE requester = 'Tim'")
|
#ret = c.execute("SELECT * from LIST WHERE requester = 'Tim'")
|
||||||
#print(ret.fetchall())
|
#print(ret.fetchall())
|
||||||
app.run()
|
app.run(host='0.0.0.0')
|
||||||
|
|||||||
12
static/css/table.css
Normal file
12
static/css/table.css
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
table {
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
border-collapse: collapse;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
td, th {
|
||||||
|
|
||||||
|
text-align: left;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
@ -1,24 +1,44 @@
|
|||||||
<html>
|
<html>
|
||||||
<body style="background: #123456">
|
<head>
|
||||||
|
<link rel="stylesheet" href="/static/css/table.css"/>
|
||||||
|
</head>
|
||||||
|
<body style="background: #868686">
|
||||||
<h1>Shopping list </h1>
|
<h1>Shopping list </h1>
|
||||||
|
<table style="width:100%; justify-content: left">
|
||||||
|
<tr>
|
||||||
|
<th>Requester</th>
|
||||||
|
<th>Item</th>
|
||||||
|
<th>Quantity</th>
|
||||||
|
<th>Got It?</th>
|
||||||
|
</tr>
|
||||||
{% for res in data %}
|
{% for res in data %}
|
||||||
|
<tr>
|
||||||
{% for field in res %}
|
{% for field in res %}
|
||||||
|
<td>
|
||||||
{{ field }}
|
{{ field }}
|
||||||
|
</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<br/>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
<table>
|
||||||
<form action="/" method="post">
|
<form action="/" method="post">
|
||||||
<label>Who Dat?</label>
|
<tr>
|
||||||
<input type="text" name='requester'/><br/>
|
<td><label>Who Dat?</label></td>
|
||||||
<label>Watchu Want?</label>
|
<td><input type="text" name='requester'/><br/></td>
|
||||||
<input type="text" name='item'/><br/>
|
</tr>
|
||||||
<label>How Many?</label>
|
<tr>
|
||||||
<input type="text" name='quantity'/><br/>
|
<td><label>Watchu Want?</label></td>
|
||||||
<label>Have we gotten it?</label>
|
<td><input type="text" name='item'/><br/></td>
|
||||||
<input type="text" name='gotten'/><br/>
|
</tr>
|
||||||
<input type="submit"/>
|
<tr>
|
||||||
|
<td><label>How Many?</label></td>
|
||||||
|
<td><input type="text" name='quantity'/><br/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><input type="submit" value="Add Item"/></td>
|
||||||
|
</tr>
|
||||||
</form>
|
</form>
|
||||||
|
</table>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user