most of way through editing publisher, author, genre on book... decided now is time to make book<->publisher a normal 1-to-m as it should be

This commit is contained in:
2020-12-02 20:55:43 +11:00
parent 93383c3bc0
commit b6ba97f049
3 changed files with 41 additions and 21 deletions

View File

@@ -1,7 +1,6 @@
{% extends "base.html" %}
{% block main_content %}
<h3><center>View/Edit Book</center></h3>
{% set keys = [ 'title', 'author', 'publisher', 'genre', 'owned', 'covertype', 'condition', 'year_published', 'rating', 'notes', 'blurb' ] %}
<div class="container-fluid">
{% if message|length %}
@@ -19,16 +18,15 @@
{% if key == "genre" %}
<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"
<input id="genre-{{genre.id}}" name="genre-{{genre.id}}" type="checkbox"
{% for book_g in books.genre %}
{% if book_g['name'] == gname %}
{% if book_g['name'] == genre.name %}
checked
{% endif %}
{% endfor %}
></input>
<label style="display:inline" for="{{gname}}" class="col-form-label">{{gname}}</label>
<label style="display:inline" for="{{genre.name}}" class="col-form-label">{{genre.name}}</label>
</div>
{% endfor %}
</div>
@@ -44,10 +42,10 @@
</button>
</div>
{% endif %}
<select class="form-control" id="author[{{cnt.idx}}]">
<select class="form-control" name="author-{{cnt.idx}}" id="author-{{cnt.idx}}">
{% for auth in author_list %}
{% set aname=auth.surname+", "+auth.firstnames %}
<option id="{{auth.id}}" value="{{auth.id}}"
<option value="{{auth.id}}"
{% if books.author[cnt.idx].id == auth.id %}
selected
{% endif %}