made settings work lamely, but functional for now, also removed test route
This commit is contained in:
7
main.py
7
main.py
@@ -29,16 +29,11 @@ Bootstrap(app)
|
|||||||
################################# Now, import non-book classes ###################################
|
################################# Now, import non-book classes ###################################
|
||||||
from settings import Settings
|
from settings import Settings
|
||||||
|
|
||||||
|
|
||||||
####################################### GLOBALS #######################################
|
####################################### GLOBALS #######################################
|
||||||
# allow jinja2 to call these python functions directly
|
# allow jinja2 to call these python functions directly
|
||||||
app.jinja_env.globals['ClearStatus'] = st.ClearStatus
|
app.jinja_env.globals['ClearStatus'] = st.ClearStatus
|
||||||
|
|
||||||
|
# default page, just the navbar
|
||||||
@app.route("/test", methods=["GET"])
|
|
||||||
def test():
|
|
||||||
return render_template("base.html", alert=st.GetAlert(), message=st.GetMessage())
|
|
||||||
|
|
||||||
@app.route("/", methods=["GET"])
|
@app.route("/", methods=["GET"])
|
||||||
def main_page():
|
def main_page():
|
||||||
return render_template("base.html", alert=st.GetAlert(), message=st.GetMessage())
|
return render_template("base.html", alert=st.GetAlert(), message=st.GetMessage())
|
||||||
|
|||||||
25
templates/setting.html
Normal file
25
templates/setting.html
Normal 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
13
templates/settings.html
Normal 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 %}
|
||||||
Reference in New Issue
Block a user