{% 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 == "condition" or key == "covertype" or key == "owned" or key == "rating" %}
{{book_form[key](class="form-control")}}
{% else %}
{% if books[key] is iterable and books[key] is not string %}
{% set cnt = namespace(idx=0, val=0) %} {% for objects in books[key] %} {% set cnt.val = 0 %} {% set str = namespace(val="") %} {% for attr in objects %} {% if attr != "id" %} {% if cnt.val > 0 %} {% set str.val=str.val+", "+objects[attr] %} {% else %} {% set str.val=str.val+objects[attr] %} {% endif %} {% set cnt.val = cnt.val + 1 %} {% endif %} {% endfor %} {{str.val}} {% set cnt.idx = cnt.idx+1 %} {% endfor %}
{% else %} {% if key == "notes" or key == "blurb" %} {% else %} {% endif %} {% endif %}
{% 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 %}