mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-23 07:28:08 +00:00
parent
9dd0e22a47
commit
becc90d485
2 changed files with 18 additions and 1 deletions
|
@ -1,5 +1,7 @@
|
||||||
{% extends 'search/layout.html' %}
|
{% extends 'search/layout.html' %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
{% load humanize %}
|
||||||
|
{% load book_display_tags %}
|
||||||
|
|
||||||
{% block panel %}
|
{% block panel %}
|
||||||
|
|
||||||
|
@ -19,8 +21,17 @@
|
||||||
</strong>
|
</strong>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
{% with book_review_count=result|review_count %}
|
||||||
|
{% blocktrans trimmed count counter=book_review_count with formatted_review_count=book_review_count|intcomma %}
|
||||||
|
{{ formatted_review_count }} review
|
||||||
|
{% plural %}
|
||||||
|
{{ formatted_review_count }} reviews
|
||||||
|
{% endblocktrans %}
|
||||||
|
{% endwith %}
|
||||||
|
|
||||||
{% if result.first_published_date or result.published_date %}
|
{% if result.first_published_date or result.published_date %}
|
||||||
({% firstof result.first_published_date.year result.published_date.year %})
|
{% firstof result.first_published_date.year result.published_date.year as pub_year %}
|
||||||
|
{% blocktrans %}(published {{ pub_year }}){% endblocktrans %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
""" template filters """
|
""" template filters """
|
||||||
from django import template
|
from django import template
|
||||||
|
from bookwyrm import models
|
||||||
|
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter(name="review_count")
|
||||||
|
def get_review_count(book):
|
||||||
|
"""how many reviews?"""
|
||||||
|
return models.Review.objects.filter(deleted=False, book=book).count()
|
||||||
|
|
||||||
@register.filter(name="book_description")
|
@register.filter(name="book_description")
|
||||||
def get_book_description(book):
|
def get_book_description(book):
|
||||||
"""use the work's text if the book doesn't have it"""
|
"""use the work's text if the book doesn't have it"""
|
||||||
|
|
Loading…
Reference in a new issue