Optical fixes in seasons list.

This commit is contained in:
2019-10-19 00:30:11 +02:00
parent d04fae47d9
commit f7eebd54f5
3 changed files with 17 additions and 20 deletions

View File

@@ -27,6 +27,7 @@ class GenericFormModel:
post_url: str post_url: str
errors: Dict[str, List[str]] = None errors: Dict[str, List[str]] = None
class SeasonForm(FlaskForm): class SeasonForm(FlaskForm):
season_id = HiddenField("Season ID", render_kw={"readonly": True}) season_id = HiddenField("Season ID", render_kw={"readonly": True})
code = StringField("Season Code", validators=[DataRequired()]) code = StringField("Season Code", validators=[DataRequired()])

View File

@@ -14,10 +14,11 @@
<table class="table table-hover table-striped table-bordered"> <table class="table table-hover table-striped table-bordered">
<thead> <thead>
<tr> <tr>
{% for prop, caption in model.columns %} <th scope="col" class="col-sm-auto text-center">#</th>
<th scope="col" class="col-sm-auto text-center">{{ caption }}</th> <th scope="col" class="col-sm-auto text-center">Game</th>
{% endfor %} <th scope="col" class="col-sm-auto text-center">Season Description</th>
<th scope="col" class="col-sm-auto text-center">Started At</th>
<th scope="col" class="col-sm-auto text-center">Ended At</th>
{# Show #} {# Show #}
<th scope="col" class="col-sm-auto text-center">View</th> <th scope="col" class="col-sm-auto text-center">View</th>
@@ -30,9 +31,11 @@
<tbody> <tbody>
{% for item in model.seasons %} {% for item in model.seasons %}
<tr> <tr>
{% for prop, caption in model.columns %} <td class="col-sm-auto text-center">{{ item.code }}</td>
<td class="col-sm-auto text-center">{{ item[prop] }}</td> <td class="col-sm-auto text-center">{{ item.game }}</td>
{% endfor %} <td class="col-sm-auto text-center">{{ item.description or "No Description" }}</td>
<td class="col-sm-auto text-center">{{ item.start }}</td>
<td class="col-sm-auto text-center">{{ item.end or "Ongoing" }}</td>
<td class="col-sm-auto text-center"> <td class="col-sm-auto text-center">
<a class="btn btn-default" href="{{ url_for("season_overview", season_id = item.id) }}"> <a class="btn btn-default" href="{{ url_for("season_overview", season_id = item.id) }}">

View File

@@ -12,14 +12,7 @@ def season_list():
db = orm.new_session() db = orm.new_session()
seasons = db.query(Season).order_by(Season.code).all() seasons = db.query(Season).order_by(Season.code).all()
model = { model = {
"seasons": seasons, "seasons": seasons
"columns": [
("code", "#"),
("game", "Game"),
("description", "Season Description"),
("start", "Started At"),
("end", "Ended At"),
],
} }
return render_template("season_list.html", model=model) return render_template("season_list.html", model=model)