make input optional and add a data updated bump

This commit is contained in:
Andrew Ridgway 2024-04-04 17:15:42 +10:00
parent e26d0774f4
commit 8bdb969aa9
3 changed files with 17 additions and 14 deletions

View File

@ -8,7 +8,7 @@ services:
context: .
dockerfile: flask.Dockerfile
volumes:
- ./src/flask:/pool_data_web/src/flask
- ./src/flask:/pool_data/src/flask
ports:
- "80:80"
- "5000:5000"

View File

@ -5,7 +5,7 @@ from flask import Flask, render_template, request, jsonify, redirect, session
from flask_wtf import FlaskForm, CSRFProtect
from flask_bootstrap import Bootstrap5
from wtforms import StringField, SubmitField, DateField, IntegerField, PasswordField, DecimalField, RadioField, TextAreaField
from wtforms.validators import DataRequired, Length
from wtforms.validators import DataRequired, Length, Optional
from waitress import serve
app = Flask(__name__)
@ -24,15 +24,15 @@ class dataForm(FlaskForm):
test_user = RadioField("Tester:",
choices=[("Isabella"), ("Heather"), ("Ariah")])
Date = DateField("Date:")
free_chlorine = IntegerField("Free Chlorine:")
total_chlorine = IntegerField("Total Chlorine:")
alkalinity = DecimalField("Alkalinity:")
PH = DecimalField("PH:")
hardness = IntegerField("Hardness")
stabiliser = IntegerField("CYA - Stabliser")
salt = IntegerField("Salt:")
temp = DecimalField("Water Temperature")
comment = TextAreaField("Any Comments?")
free_chlorine = IntegerField("Free Chlorine:", validators=[Optional()])
total_chlorine = IntegerField("Total Chlorine:", validators=[Optional()])
alkalinity = DecimalField("Alkalinity:", validators=[Optional()])
PH = DecimalField("PH:", validators=[Optional()])
hardness = IntegerField("Hardness", validators=[Optional()])
stabiliser = IntegerField("CYA - Stabliser", validators=[Optional()])
salt = IntegerField("Salt:", validators=[Optional()])
temp = DecimalField("Water Temperature", validators=[Optional()])
comment = TextAreaField("Any Comments?", validators=[Optional()])
submit = SubmitField("Write it, Write it REAAAAAAL GOOOD")
@app.route("/", methods=["GET","POST"])
@ -87,9 +87,9 @@ def updater():
new_record["salt"], new_record["comment"])
return render_template("updater.html", list=query, form=form)
return render_template("updater.html", list=query, form=form, success=True, updater_name = new_record["test_user"])
else:
return render_template("updater.html", list=query, form=form)
return render_template("updater.html", list=query, form=form, sucess=False)
@app.route("/update_db", methods=["POST"])
def pool_data_update():

View File

@ -5,7 +5,6 @@
Data Input
{% endblock %}
{% block content %}
<!--
TIPS about using Bootstrap-Flask:
https://github.com/helloflask/bootstrap-flask
@ -17,6 +16,10 @@
<div class="col-md-10 col-lg-8 mx-lg-auto mx-md-auto">
<h1 class="pt-5 pb-2">Input Data you want to store</h1>
{% if success %}
<h3 class="pt-3 pb02">Thank you {{ updater_name | safe }}, Data Updated Successfully</h1>
{% endif %}
<div class="row">
<div class="col-md-6">
<table border=0>