Merge branch 'master' of 192.168.0.2:pybook
This commit is contained in:
13
README
13
README
@@ -21,11 +21,16 @@ python3 main.py
|
||||
### TODO:
|
||||
- ORM:
|
||||
- saving a book with the ORM is probably the last oddity... probably time to try it (in a sense, the book edit page is the only time we change things, maybe we mess with that book-query as its too slow, and for book edit, if we don't allow editing items like author/publisher, then may only need to set the objects we want to change... I'm sort of curious can you save a book table based on id, without saging its author table, seems that should be okay, but how do I save both, just create 2 objects and do it, but what if the ORM has auto-connected bunches of stuff, how do I update the connected stuff.... MAYBE, I need to get say loan or something first, then try all this? (make a pop-up for stuff like loans, but what about series or sub-book editing????)
|
||||
- should see if I can make the publisher, rating, covertype, condition, genre tables have generic .html files
|
||||
- complete BookSchema(FlaskForm)
|
||||
- have no html for sub_book
|
||||
- need to save a book
|
||||
- need to allow create all classes
|
||||
- need to delete all classes
|
||||
- need to have up/down buttons for book in series (and sub book)
|
||||
- need to delete 1 book from sub_book, series, loan
|
||||
- add stats page
|
||||
- show books on shelf list
|
||||
- show books to buy view / printable
|
||||
|
||||
|
||||
- consider getting rest of Book class connected, e.g. series, etc.
|
||||
|
||||
### MAYBE, I should make this a self-contained docker instance, then its a copy of the DB and anything I break will be fixable
|
||||
### next step is to rename genre_lst to genre, and maybe do similar to all _lst tables... then add genre.py in and get it to work
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
<h3><center>View/Edit Book</center></h1>
|
||||
{% set keys = [ 'title', 'author', 'publisher', 'genre', 'owned', 'covertype', 'condition', 'year_published', 'rating', 'notes', 'blurb' ] %}
|
||||
{{books.owned}}
|
||||
<div class="container"><div class="row"><form class="form col-lg-12">
|
||||
<div class="container-fluid"><div class="row"><form class="form col-lg-10">
|
||||
{% for key in keys %}
|
||||
<div class="form-row">
|
||||
<label for="{{key}}" class="col-lg-2 col-form-label">{{key}}:</label>
|
||||
@@ -86,7 +85,19 @@
|
||||
{% endif %}
|
||||
</div class="form-row">
|
||||
{% endfor %}
|
||||
</form></div class="row"></div class="container">
|
||||
{% if books.series|length %}
|
||||
<div class="form-row">
|
||||
<label for="series" class="col-lg-2 col-form-label">Series:</label>
|
||||
<table>
|
||||
{% for s in books.series %}
|
||||
<tr><td>
|
||||
Book {{ SeriesBookNum( s.id, books.id ) }} of {{s.num_books}} in <a href="/series/{{s.id}}">{{s.title}}</a>
|
||||
</td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if books.sub_book|length %}
|
||||
<p>sub_book is defined: {{books.sub_book}}</p>
|
||||
{% endif %}
|
||||
@@ -94,7 +105,20 @@
|
||||
<p>subs is defined {{ books.subs }}</p>
|
||||
{% endif %}
|
||||
{% if books.loan|length %}
|
||||
<p>loan is defined: {{books.loan}}</p>
|
||||
<div class="col">
|
||||
<div class="card border-info" style="max-width: 18rem;">
|
||||
<div class="card-header">Loaned to</div>
|
||||
<div class="card-body text-info">
|
||||
<h5 class="card-title">{{books.loan[0].firstnames}} {{books.loan[0].surname}}</h5>
|
||||
<p class="card-text">
|
||||
When: {{books.loan[0].date_lent}}<br>
|
||||
Contact: {{books.loan[0].contact_details}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div class="row">
|
||||
</div class="container">
|
||||
|
||||
{% endblock main_content %}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<tr class="thead-light"><th>Title</th><th>Book Number</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% set last = namespace(val=0) %}
|
||||
{% for book in books %}
|
||||
<tr>
|
||||
<td>
|
||||
@@ -13,7 +14,13 @@
|
||||
<a id="down-{{book.id}}" class="btn btn-outline-primary btn-small" style="{{style}}" href="#"><i class="fas fa-angle-double-down"></i></a>
|
||||
<a href="/book/{{book.id}}">{{book.title}}</a>
|
||||
</td>
|
||||
<td data-sort="{{series.id}}.{{"%02d".format( SeriesBookNum( series.id, book.id ))}}">
|
||||
{% set num = SeriesBookNum( series.id, book.id ) %}
|
||||
{% if num == None %}
|
||||
{# okay, if this is a parent book, the num == None, so make it use last real-book and add .01 to it to make sure it sorts just after the last one #}
|
||||
<td data-sort="{{series.id}}.{{"{:02d}1".format( last.val )}}">
|
||||
{% else %}
|
||||
<td data-sort="{{series.id}}.{{"{:02d}".format( num )}}">
|
||||
{% endif %}
|
||||
{% for s in book.series %}
|
||||
{% if not book.child_ref|length %}
|
||||
{{ SeriesBookNum( s.id, book.id ) }} of <a href="/series/{{s.id}}">{{s.title}}</a><br>
|
||||
@@ -36,6 +43,7 @@
|
||||
{% endif %}
|
||||
</script>
|
||||
{% endif %}
|
||||
{% set last.val = num %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user