made settings work lamely, but functional for now, also removed test route

This commit is contained in:
2021-01-10 15:46:41 +11:00
parent 64d3e3e4cd
commit cf1adb3e6e
3 changed files with 39 additions and 6 deletions

View File

@@ -29,16 +29,11 @@ Bootstrap(app)
################################# Now, import non-book classes ###################################
from settings import Settings
####################################### GLOBALS #######################################
# allow jinja2 to call these python functions directly
app.jinja_env.globals['ClearStatus'] = st.ClearStatus
@app.route("/test", methods=["GET"])
def test():
return render_template("base.html", alert=st.GetAlert(), message=st.GetMessage())
# default page, just the navbar
@app.route("/", methods=["GET"])
def main_page():
return render_template("base.html", alert=st.GetAlert(), message=st.GetMessage())

25
templates/setting.html Normal file
View File

@@ -0,0 +1,25 @@
{% extends "base.html" %} {% block main_content %}
<div class="container">
<h3 class="offset-lg-2">{{page_title}}</h3>
<div class="row">
<form class="form form-inline col-xl-12" action="" method="POST">
{% for field in form %}
{% if field.type == 'HiddenField' or field.type == 'CSRFTokenField' %}
{{field}}
{% elif field.type != 'SubmitField' %}
<div class="form-row col-lg-12">
{{ field.label( class="col-lg-2" ) }}
{{ field( class="form-control col-lg-4" ) }}
</div class="form-row col-lg-12">
{% endif %}
{% endfor %}
<div class="row col-lg-12">
<br>
</div class="row">
<div class="form-row col-lg-12">
{{ form.submit( class="btn btn-primary offset-lg-2 col-lg-2" )}}
</div class="form-row">
</form>
</div class="row">
</div class="container">
{% endblock main_content %}

13
templates/settings.html Normal file
View File

@@ -0,0 +1,13 @@
{% extends "base.html" %} {% block main_content %}
<div class="container">
<h3 class="offset-lg-2">{{page_title}}</h3>
<div class="row">
<table class="table table table-sm col-xl-12">
<thead><tr><th>Name</th><th>Value</th></tr></thead><tbody>
{% for obj in objects %}
<tr><td><a href="{{url_for('setting', id=obj.id)}}">{{obj.name}}</a></td><td>{{obj.value}}</td></tr>
{% endfor %}
</tbody></table>
</div class="row">
</div class="container">
{% endblock main_content %}