add helper function GetGenreList - passes all genres to *.html, so horizontal "list" of checkboxes for book can be created

This commit is contained in:
2020-11-21 12:26:38 +11:00
parent 151e006154
commit bcf5937869
2 changed files with 28 additions and 5 deletions

View File

@@ -6,7 +6,26 @@
<div class="row">
<form class="form col-lg-12">
{% for key in keys %}
{% if key == "condition" or key == "covertype" or key == "owned" or key == "rating" %}
{% if key == "genre" %}
<div class="form-row">
<label class="col-lg-2 col-form-label">{{key}}:</label>
<div class="form-row col-lg-10">
{% for genre in genre_list %}
{% set gname=genre.name %}
<div class="form-control col" style="margin-left:5px;margin-right:-5px;">
<input id="{{gname}}" name="{{gname}}" type="checkbox"
{% for book_g in books.genre %}
{% if book_g['name'] == gname %}
checked
{% endif %}
{% endfor %}
></input>
<label style="display:inline" for="{{gname}}" class="col-form-label">{{gname}}</label>
</div>
{% endfor %}
</div>
</div class="form-row">
{% elif key == "condition" or key == "covertype" or key == "owned" or key == "rating" %}
<div class="form-row">
<label for="{{key}}" class="col-lg-2 col-form-label">{{key}}:</label>
<div class="col-lg-10">
@@ -56,8 +75,11 @@
{% if books.sub_book|length %}
<p>sub_book is defined: {{books.sub_book}}</p>
{% endif %}
{% if books.subs|length %}
<p>subs is defined {{ books.subs }}</p>
{% endif %}
{% if books.loan|length %}
<p>loan is defined: {{books.loan}}</p>
{% endif %}
{{ books.subs }}
{% endblock main_content %}