Show all matching annual data for glacier's name

This commit is contained in:
2020-01-09 22:30:00 +01:00
parent 65d3af6817
commit 1e52bcae0d
5 changed files with 21 additions and 19 deletions

View File

@@ -21,8 +21,8 @@ class YearForm(FlaskForm):
("2017", 2017),
("2018", 2018),
]
name = StringField("Glacier Name")
year = SelectField("Year", validators=[DataRequired()], choices=year_list)
name = StringField("Search by Glacier Name")
year = SelectField("Search by Year", validators=[DataRequired()], choices=year_list)
submit = SubmitField("Search")

View File

@@ -60,9 +60,6 @@ def table_selection():
form = YearForm()
if form.validate_on_submit():
query = query_annual_data(form)
if query.scalar() is None:
flash("Sorry, no results found")
return redirect(url_for("table_selection"))
table = create_table(query.statement)
return render_template("table.html", table=table, title="Table")
return render_template("table_selection.html", title="Data", form=form)

View File

@@ -2,11 +2,11 @@
{% import 'bootstrap/wtf.html' as wtf %}
{% block app_content %}
<h1>Sign In</h1>
<div class="row">
<div class="col-md-4">
{{ wtf.quick_form(form) }}
</div>
<h1>Sign In</h1>
<div class="row">
<div class="col-md-4">
{{ wtf.quick_form(form) }}
</div>
<br>
</div>
<br>
{% endblock %}

View File

@@ -4,4 +4,5 @@
{% block app_content %}
<h1>Table</h1>
{{ table|safe }}
<p><a href="{{ url_for('table_selection') }}">Back</a></p>
{% endblock %}