forked from mirrors/bookwyrm
Get all books for tag
This commit is contained in:
parent
375ff9365f
commit
cb6b98992c
3 changed files with 8 additions and 4 deletions
|
@ -113,6 +113,10 @@ h2 {
|
||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.book-preview.grid {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
.book-cover.small {
|
.book-cover.small {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<div>
|
<div>
|
||||||
<h2>Books tagged "{{ tag.name }}"</h2>
|
<h2>Books tagged "{{ tag.name }}"</h2>
|
||||||
{% for book in books.all %}
|
{% for book in books.all %}
|
||||||
<div class="book-preview">
|
<div class="book-preview grid">
|
||||||
{% include 'snippets/book.html' with book=book size=large %}
|
{% include 'snippets/book.html' with book=book size=large %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -243,11 +243,11 @@ def author_page(request, author_identifier):
|
||||||
|
|
||||||
def tag_page(request, tag_id):
|
def tag_page(request, tag_id):
|
||||||
''' books related to a tag '''
|
''' books related to a tag '''
|
||||||
tag = models.Tag.objects.filter(identifier=tag_id).first()
|
tag_obj = models.Tag.objects.filter(identifier=tag_id).first()
|
||||||
books = models.Book.objects.filter(tag=tag).all()
|
books = models.Book.objects.filter(tag__identifier=tag_id)
|
||||||
data = {
|
data = {
|
||||||
'books': books,
|
'books': books,
|
||||||
'tag': tag,
|
'tag': tag_obj,
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, 'tag.html', data)
|
return TemplateResponse(request, 'tag.html', data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue