forked from mirrors/bookwyrm
Fixes decimaal formatting
This commit is contained in:
parent
9dc19b8bff
commit
1d53a06e35
4 changed files with 6 additions and 4 deletions
|
@ -450,4 +450,6 @@ class DecimalField(ActivitypubFieldMixin, models.DecimalField):
|
|||
""" activitypub-aware boolean field """
|
||||
|
||||
def field_to_activity(self, value):
|
||||
if not value:
|
||||
return None
|
||||
return float(value)
|
||||
|
|
|
@ -306,7 +306,7 @@ class Review(Status):
|
|||
""" clarify review names for mastodon serialization """
|
||||
template = get_template("snippets/generated_status/review_pure_name.html")
|
||||
return template.render(
|
||||
{"book": self.book, "rating": int(self.rating), "name": self.name}
|
||||
{"book": self.book, "rating": self.rating, "name": self.name}
|
||||
).strip()
|
||||
|
||||
@property
|
||||
|
@ -329,7 +329,7 @@ class ReviewRating(Review):
|
|||
@property
|
||||
def pure_content(self):
|
||||
template = get_template("snippets/generated_status/rating.html")
|
||||
return template.render({"book": self.book, "rating": int(self.rating)}).strip()
|
||||
return template.render({"book": self.book, "rating": self.rating}).strip()
|
||||
|
||||
activity_serializer = activitypub.Rating
|
||||
pure_type = "Note"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
{% load i18n %}{% load humanize %}
|
||||
|
||||
{% blocktrans with title=book.title path=book.remote_id rating=rating count counter=rating %}Rated <em><a href="{{ path }}">{{ title }}</a></em>: {{ rating }} star{% plural %}Rated <em><a href="{{ path }}">{{ title }}</a></em>: {{ rating }} stars{% endblocktrans %}
|
||||
{% blocktrans with title=book.title path=book.remote_id rating=rating|floatformat:"0" count counter=rating %}Rated <em><a href="{{ path }}">{{ title }}</a></em>: {{ rating }} star{% plural %}Rated <em><a href="{{ path }}">{{ title }}</a></em>: {{ rating }} stars{% endblocktrans %}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% load i18n %}
|
||||
{% if rating %}
|
||||
|
||||
{% blocktrans with book_title=book.title rating=rating review_title=name count counter=rating %}Review of <em>{{ book_title }}</em> ({{ rating }} star): {{ review_title }}{% plural %}Review of <em>{{ book_title }}</em> ({{ rating }} stars): {{ review_title }}{% endblocktrans %}
|
||||
{% blocktrans with book_title=book.title rating=rating|floatformat:"0" review_title=name count counter=rating %}Review of <em>{{ book_title }}</em> ({{ rating }} star): {{ review_title }}{% plural %}Review of <em>{{ book_title }}</em> ({{ rating }} stars): {{ review_title }}{% endblocktrans %}
|
||||
|
||||
{% else %}
|
||||
|
||||
|
|
Loading…
Reference in a new issue