From 030dc33d551b992846a936444c18c5331c040860 Mon Sep 17 00:00:00 2001 From: Gogs Date: Sun, 29 Jan 2017 00:37:38 -0500 Subject: [PATCH] Allow date/time-free entries --- influx_frontend.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/influx_frontend.py b/influx_frontend.py index f8930b7..ecba7cc 100644 --- a/influx_frontend.py +++ b/influx_frontend.py @@ -1,4 +1,6 @@ from flask import Flask, request, render_template, redirect, url_for +from time import strftime +import datetime app = Flask(__name__) from influxdb import InfluxDBClient @@ -18,10 +20,16 @@ def main_page(): @app.route('/add_time', methods=['POST', 'GET']) def add_time(): + today = strftime("%Y-%m-%d") + now = strftime("%H:%M:%S") # database = request.form['db'] # table = request.form['table'] date = request.form['date'] + if date == '': + date = today time = request.form['time'] + if time == '': + time = now odometer = request.form['odometer'] oilhealth= request.form['oilhealth'] fuel = request.form['fuel']