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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue