Commit 095a5350 authored by Kristian Tan's avatar Kristian Tan

Added input box for kWh ptice

parent 12ab271f
from flask import Flask, render_template from flask import Flask, render_template, request
import RPi.GPIO as GPIO import RPi.GPIO as GPIO
from flask_sqlalchemy import SQLAlchemy from flask_sqlalchemy import SQLAlchemy
...@@ -135,6 +135,17 @@ def create_entry(change_pin): ...@@ -135,6 +135,17 @@ def create_entry(change_pin):
pins[change_pin]['on_time'] = None pins[change_pin]['on_time'] = None
pins[change_pin]['on_date'] = None pins[change_pin]['on_date'] = None
@app.route('/handle_data', methods=['POST'])
def handle_data():
projectpath = request.form['kWhprice']
print(projectpath)
template_data = {
'pins': pins,
'daily_total': daily_total,
'todays_cost': todays_cost
}
return render_template('main.html', **template_data)
if __name__ == '__main__': if __name__ == '__main__':
app.run(host='0.0.0.0', port=8090) app.run(host='0.0.0.0', port=8090)
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
<body> <body>
<div class="container"> <div class="container">
<form action="{{ url_for('handle_data') }}" method="post">
<input type="text" name="kWhprice">
<input type="submit">
</form>
<div class="device_list"> <div class="device_list">
<h3 class="device_list_title">Device Listing and Status</h3> <h3 class="device_list_title">Device Listing and Status</h3>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment