-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
137 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
ram/bookshelf/migrations/0004_rename_numbers_of_pages_book_number_of_pages.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.2.5 on 2023-10-02 20:38 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("bookshelf", "0003_bookimage"), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name="book", | ||
old_name="numbers_of_pages", | ||
new_name="number_of_pages", | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
{% extends "cards.html" %} | ||
|
||
{% block cards %} | ||
{% for d in data %} | ||
<div class="col"> | ||
<div class="card shadow-sm"> | ||
{% if d.image.all %} | ||
{# FIXME <a href="{{ d.get_absolute_url }}"> #} | ||
{% for r in d.image.all %} | ||
{% if forloop.first %}<img src="{{ r.image.url }}" alt="Card image cap">{% endif %} | ||
{% endfor %} | ||
{# FIXME </a> #} | ||
{% endif %} | ||
<div class="card-body"> | ||
<p class="card-text" style="position: relative;"> | ||
<strong>{{ d }}</strong> | ||
{# <a class="stretched-link" href="{{ d.get_absolute_url }}"></a> #} | ||
</p> | ||
{% if d.tags.all %} | ||
<p class="card-text"><small>Tags:</small> | ||
{% for t in d.tags.all %}<a href="{% url 'filtered' _filter="tag" search=t.slug %}" class="badge rounded-pill bg-primary"> | ||
{{ t.name }}</a>{# new line is required #} | ||
{% endfor %} | ||
</p> | ||
{% endif %} | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th colspan="2" scope="row">Book</th> | ||
</tr> | ||
</thead> | ||
<tbody class="table-group-divider"> | ||
<tr> | ||
<th class="w-33" scope="row">Authors</th> | ||
<td> | ||
<ul class="mb-0 list-unstyled">{% for a in d.authors.all %}<li>{{ a }}</li>{% endfor %}</ul> | ||
</td> | ||
</tr> | ||
<tr> | ||
<th class="w-33" scope="row">Publisher</th> | ||
<td>{{ d.publisher }}</td> | ||
</tr> | ||
<tr> | ||
<th scope="row">Language</th> | ||
<td>{{ d.get_language_display }}</td> | ||
</tr> | ||
<tr> | ||
<th scope="row">Pages</th> | ||
<td>{{ d.number_of_pages }}</td> | ||
</tr> | ||
<tr> | ||
<th scope="row">Year</th> | ||
<td>{{ d.publication_year }}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<div class="d-grid gap-2 mb-1 d-md-block"> | ||
{# FIXME <a class="btn btn-sm btn-outline-primary" href="{{ d.get_absolute_url }}">Show all data</a> #} | ||
{% if request.user.is_staff %}<a class="btn btn-sm btn-outline-danger" href="{% url 'admin:bookshelf_book_change' d.pk %}">Edit</a>{% endif %} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endfor %} | ||
{% endblock %} | ||
{% block pagination %} | ||
{% if data.has_other_pages %} | ||
<nav aria-label="Page navigation example"> | ||
<ul class="pagination justify-content-center mt-4 mb-0"> | ||
{% if data.has_previous %} | ||
<li class="page-item"> | ||
<a class="page-link" href="{% url 'books_pagination' page=data.previous_page_number %}#rolling-stock" tabindex="-1">Previous</a> | ||
</li> | ||
{% else %} | ||
<li class="page-item disabled"> | ||
<span class="page-link">Previous</span> | ||
</li> | ||
{% endif %} | ||
{% for i in page_range %} | ||
{% if data.number == i %} | ||
<li class="page-item active"> | ||
<span class="page-link">{{ i }}</span> | ||
</li> | ||
{% else %} | ||
{% if i == data.paginator.ELLIPSIS %} | ||
<li class="page-item"><span class="page-link">{{ i }}</span></li> | ||
{% else %} | ||
<li class="page-item"><a class="page-link" href="{% url 'books_pagination' page=i %}#rolling-stock">{{ i }}</a></li> | ||
{% endif %} | ||
{% endif %} | ||
{% endfor %} | ||
{% if data.has_next %} | ||
<li class="page-item"> | ||
<a class="page-link" href="{% url 'books_pagination' page=data.next_page_number %}#rolling-stock" tabindex="-1">Next</a> | ||
</li> | ||
{% else %} | ||
<li class="page-item disabled"> | ||
<span class="page-link">Next</span> | ||
</li> | ||
{% endif %} | ||
</ul> | ||
</nav> | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters