split out old books into book and books.html, all *.html now using extends and {% block %} in jinja2. So navbar is now present in all URLs
This commit is contained in:
43
templates/book.html
Normal file
43
templates/book.html
Normal file
@@ -0,0 +1,43 @@
|
||||
{% 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">
|
||||
<div class="row with-margin">
|
||||
<form class="form col-lg-12">
|
||||
{% for key in keys %}
|
||||
<div class="input-group input-group-lg">
|
||||
<label for="{{key}}" class="col-lg-2 col-form-label">{{key}}:</label>
|
||||
<div class="col-lg-10">
|
||||
{% if books[key] is iterable and books[key] is not string %}
|
||||
<table>
|
||||
{% for objects in books[key] %}
|
||||
<tr>
|
||||
{% for attr in objects %}
|
||||
{% if attr != "id" %}
|
||||
<td>
|
||||
<input type="text" class="form-control input-lg" id="not-sure-{{key}}-{{attr}}" value="{{objects[attr]}}">
|
||||
</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% else %}
|
||||
{% if key == "notes" or key == "blurb" %}
|
||||
<textarea rows="5" type="text" class="form-control input-lg" id="{{key}}">{{books[key]}}</textarea>
|
||||
{% else %}
|
||||
<input type="text" class="form-control input-lg" id="{{key}}" value="{{books[key]}}">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div class="col-lg-8">
|
||||
</div class="form-group">
|
||||
{% endfor %}
|
||||
</form>
|
||||
</div class="row">
|
||||
</div class="container">
|
||||
{% if books.sub_book|length %}
|
||||
<p>sub_book is defined: {{books.sub_book}}</p>
|
||||
{% endif %}
|
||||
{{ books.subs }}
|
||||
{% endblock main_content %}
|
||||
Reference in New Issue
Block a user