moved to using a Get*ById() in condition, covertype, owned files and exposing them in jinja and using them in books.html to fix-up the fact those columns were now raw forein keys (ids)

This commit is contained in:
2020-11-22 00:23:18 +11:00
parent 1edf5082c7
commit 9466e61db9
5 changed files with 31 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block main_content %}
<h3>All Books</h1>
<h3>All Books</h1>
<table id="book_table" class="table table-striped table-sm" data-toolbar="#toolbar" data-search="true">
<thead>
<tr class="thead-light"><th>Title</th><th>Author</th><th>Publisher</th><th>Condition</th><th>Owned</th><th>Covertype</th></tr>
@@ -16,16 +16,17 @@
<td>{{ book.author[0]['surname'] }}, {{book.author[0]['firstnames']}}</td>
<td>{{ book.publisher[0]['name']}}</td>
<td align="center">
{% if book.condition == "Good" %}
{% set cond = GetConditionById(book.condition) %}
{% if cond == "Good" %}
<i class="fas fa-book" style="color:black"></i>
{% elif book.condition == "Average" %}
{% elif cond == "Average" %}
<i class="fas fa-book" style="color:orange"></i>
{% else %}
<i class="fas fa-book" style="color:red"></i>
{% endif %}
</td>
<td>{{ book.owned}}</td>
<td>{{ book.covertype}}</td>
<td>{{ GetOwnedById(book.owned)}}</td>
<td>{{ GetCovertypeById(book.covertype) }}</td>
</tr>
{% endfor %}
</tbody>