make input optional and add a data updated bump
This commit is contained in:
parent
e26d0774f4
commit
8bdb969aa9
@ -8,7 +8,7 @@ services:
|
|||||||
context: .
|
context: .
|
||||||
dockerfile: flask.Dockerfile
|
dockerfile: flask.Dockerfile
|
||||||
volumes:
|
volumes:
|
||||||
- ./src/flask:/pool_data_web/src/flask
|
- ./src/flask:/pool_data/src/flask
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
- "5000:5000"
|
- "5000:5000"
|
||||||
|
@ -5,7 +5,7 @@ from flask import Flask, render_template, request, jsonify, redirect, session
|
|||||||
from flask_wtf import FlaskForm, CSRFProtect
|
from flask_wtf import FlaskForm, CSRFProtect
|
||||||
from flask_bootstrap import Bootstrap5
|
from flask_bootstrap import Bootstrap5
|
||||||
from wtforms import StringField, SubmitField, DateField, IntegerField, PasswordField, DecimalField, RadioField, TextAreaField
|
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
|
from waitress import serve
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
@ -24,15 +24,15 @@ class dataForm(FlaskForm):
|
|||||||
test_user = RadioField("Tester:",
|
test_user = RadioField("Tester:",
|
||||||
choices=[("Isabella"), ("Heather"), ("Ariah")])
|
choices=[("Isabella"), ("Heather"), ("Ariah")])
|
||||||
Date = DateField("Date:")
|
Date = DateField("Date:")
|
||||||
free_chlorine = IntegerField("Free Chlorine:")
|
free_chlorine = IntegerField("Free Chlorine:", validators=[Optional()])
|
||||||
total_chlorine = IntegerField("Total Chlorine:")
|
total_chlorine = IntegerField("Total Chlorine:", validators=[Optional()])
|
||||||
alkalinity = DecimalField("Alkalinity:")
|
alkalinity = DecimalField("Alkalinity:", validators=[Optional()])
|
||||||
PH = DecimalField("PH:")
|
PH = DecimalField("PH:", validators=[Optional()])
|
||||||
hardness = IntegerField("Hardness")
|
hardness = IntegerField("Hardness", validators=[Optional()])
|
||||||
stabiliser = IntegerField("CYA - Stabliser")
|
stabiliser = IntegerField("CYA - Stabliser", validators=[Optional()])
|
||||||
salt = IntegerField("Salt:")
|
salt = IntegerField("Salt:", validators=[Optional()])
|
||||||
temp = DecimalField("Water Temperature")
|
temp = DecimalField("Water Temperature", validators=[Optional()])
|
||||||
comment = TextAreaField("Any Comments?")
|
comment = TextAreaField("Any Comments?", validators=[Optional()])
|
||||||
submit = SubmitField("Write it, Write it REAAAAAAL GOOOD")
|
submit = SubmitField("Write it, Write it REAAAAAAL GOOOD")
|
||||||
|
|
||||||
@app.route("/", methods=["GET","POST"])
|
@app.route("/", methods=["GET","POST"])
|
||||||
@ -87,9 +87,9 @@ def updater():
|
|||||||
new_record["salt"], new_record["comment"])
|
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:
|
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"])
|
@app.route("/update_db", methods=["POST"])
|
||||||
def pool_data_update():
|
def pool_data_update():
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
Data Input
|
Data Input
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
TIPS about using Bootstrap-Flask:
|
TIPS about using Bootstrap-Flask:
|
||||||
https://github.com/helloflask/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">
|
<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>
|
<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="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<table border=0>
|
<table border=0>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user