Allow date/time-free entries

This commit is contained in:
Gogs 2017-01-29 00:37:38 -05:00
parent 6c354e40a9
commit 030dc33d55

View File

@ -1,4 +1,6 @@
from flask import Flask, request, render_template, redirect, url_for from flask import Flask, request, render_template, redirect, url_for
from time import strftime
import datetime
app = Flask(__name__) app = Flask(__name__)
from influxdb import InfluxDBClient from influxdb import InfluxDBClient
@ -18,10 +20,16 @@ def main_page():
@app.route('/add_time', methods=['POST', 'GET']) @app.route('/add_time', methods=['POST', 'GET'])
def add_time(): def add_time():
today = strftime("%Y-%m-%d")
now = strftime("%H:%M:%S")
# database = request.form['db'] # database = request.form['db']
# table = request.form['table'] # table = request.form['table']
date = request.form['date'] date = request.form['date']
if date == '':
date = today
time = request.form['time'] time = request.form['time']
if time == '':
time = now
odometer = request.form['odometer'] odometer = request.form['odometer']
oilhealth= request.form['oilhealth'] oilhealth= request.form['oilhealth']
fuel = request.form['fuel'] fuel = request.form['fuel']