make book form do a POST, have save/del buttons, and rewrote to remove parent_ref and just use parent from ORM

This commit is contained in:
2020-12-01 20:25:37 +11:00
parent ce34f68254
commit 43b307d063

View File

@@ -1,9 +1,18 @@
{% extends "base.html" %}
{% block main_content %}
<h3><center>View/Edit Book</center></h1>
{% set keys = [ 'title', 'author', 'publisher', 'genre', 'owned', 'covertype', 'condition', 'year_published', 'rating', 'notes', 'blurb' ] %}
<div class="container-fluid"><div class="row"><form class="form col-lg-10">
<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 %}
<div class="row alert alert-{{alert}}">
{{message}}
</div>
{% endif %}
<div class="row">
<form role="form" class="form col-lg-10" action="" method="POST">
{{ book_form.id }}
{{ book_form.csrf_token }}
{% for key in keys %}
<div class="form-row">
<label for="{{key}}" class="col-lg-2 col-form-label">{{key}}:</label>
@@ -111,7 +120,7 @@
</div>
</div>
{% endif %}
{% if books.parent_ref|length %}
{% if b.parent|length %}
<div class="form-row">
<label class="col-lg-2 col-form-label">Parent Book:</label>
<div class="col">
@@ -119,6 +128,10 @@
</div>
</div>
{% endif %}
<div class="form-row col-lg-12">
{{ book_form.delete( class="btn btn-outline-danger offset-lg-2 col-lg-2" )}}
{{ book_form.submit( class="btn btn-primary col-lg-2" )}}
</div class="form-row">
</form>
{% if books.loan|length %}
<div class="col">
@@ -134,8 +147,9 @@
</div>
</div>
{% endif %}
</div class="row">
</div class="container">
</div class="row">
</div class="container">
{% endblock main_content %}
{% if books.child_ref|length %}