{% extends "base.html" %} {% block main_content %}

View/Edit Book

{% set keys = [ 'title', 'author', 'publisher', 'genre', 'owned', 'covertype', 'condition', 'year_published', 'rating', 'notes', 'blurb' ] %}
{% for key in keys %}
{% if key == "genre" %}
{% for genre in genre_list %} {% set gname=genre.name %}
{% endfor %}
{% elif key == "publisher" %}
{{books[key][0].name}}
{% elif key == "author" %}
{% set cnt = namespace(idx=0) %} {% for objects in books[key] %} {{books.author[cnt.idx].surname + ", " + books.author[cnt.idx].firstnames}} {% set cnt.idx = cnt.idx+1 %} {% endfor %}
{% else %}
{{book_form[key](class="form-control", value=books[key], rows="5" )}}
{% endif %}
{% endfor %}
{% if books.sub_book|length %}

sub_book is defined: {{books.sub_book}}

{% endif %} {% if books.subs|length %}

subs is defined {{ books.subs }}

{% endif %} {% if books.loan|length %}

loan is defined: {{books.loan}}

{% endif %} {% endblock main_content %}