removed all old *_lst tables, added corresponding new classes, etc. fro covertype, owned, rating, and dropped tables from DB, etc. Updated base.html to use new tables as drop-downs that are set correctly. So far slight hack on BookForm, will finish that after syncing this all back to mara. If I do the sync, and export/import this version of DB, then the fixes.sql and fix_db() code included in main.py can be removed. Finally, lamely added a favicon and a static/ to support it
This commit is contained in:
@@ -3,44 +3,52 @@
|
||||
<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">
|
||||
<div class="row">
|
||||
<form class="form col-lg-12">
|
||||
{% for key in keys %}
|
||||
<div class="input-group input-group-lg">
|
||||
{% if key == "condition" or key == "covertype" or key == "owned" or key == "rating" %}
|
||||
<div class="form-row">
|
||||
<label for="{{key}}" class="col-lg-2 col-form-label">{{key}}:</label>
|
||||
<div class="col-lg-10">
|
||||
{{book_form[key](class="form-control")}}
|
||||
</div class="col-lg-10">
|
||||
</div class="form-row">
|
||||
{% else %}
|
||||
<div class="form-row">
|
||||
<label for="{{key}}" class="col-lg-2 col-form-label">{{key}}:</label>
|
||||
<div class="col-lg-10">
|
||||
<div class="row">
|
||||
{% 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] %}
|
||||
{% if books[key] is iterable and books[key] is not string %}
|
||||
<div class="row" style="margin-left:0px; margin-right:0px;">
|
||||
{% 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 %}
|
||||
{% set cnt.val = cnt.val + 1 %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<span class="form-control col-lg-{{((12/books[key]|length)|int)}}" id="{{key}}-{{books[key][cnt.idx].id}}">
|
||||
<a href="{{url_for(key, id=books[key][cnt.idx].id)}}">{{str.val}}</a>
|
||||
</span>
|
||||
{% set cnt.idx = cnt.idx+1 %}
|
||||
{% endfor %}
|
||||
<span class="form-control col-lg-{{((12/books[key]|length)|int)}}" id="{{key}}-{{books[key][cnt.idx].id}}">
|
||||
<a href="{{url_for(key, id=books[key][cnt.idx].id)}}">{{str.val}}</a>
|
||||
</span>
|
||||
{% set cnt.idx = cnt.idx+1 %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</table>
|
||||
{% else %}
|
||||
{% if key == "notes" or key == "blurb" %}
|
||||
<textarea rows="5" type="text" class="form-control input-lg" id="{{key}}">{{books[key]}}</textarea>
|
||||
</div class="row">
|
||||
{% else %}
|
||||
<input type="text" class="form-control input-lg" id="{{key}}" value="{{books[key]}}">
|
||||
{% 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 %}
|
||||
{% endif %}
|
||||
</div class="col-lg-8">
|
||||
</div class="form-group">
|
||||
</div class="col-lg-10">
|
||||
</div class="form-row">
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</form>
|
||||
</div class="row">
|
||||
|
||||
Reference in New Issue
Block a user