diff --git a/CalibreWebCompanion/db.sqlite3 b/CalibreWebCompanion/db.sqlite3 index 0604770..d5c379a 100644 Binary files a/CalibreWebCompanion/db.sqlite3 and b/CalibreWebCompanion/db.sqlite3 differ diff --git a/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc b/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc index 1d3aac9..9625490 100644 Binary files a/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc and b/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc differ diff --git a/CalibreWebCompanion/library/__pycache__/views.cpython-38.pyc b/CalibreWebCompanion/library/__pycache__/views.cpython-38.pyc index 5089de3..f897e15 100644 Binary files a/CalibreWebCompanion/library/__pycache__/views.cpython-38.pyc and b/CalibreWebCompanion/library/__pycache__/views.cpython-38.pyc differ diff --git a/CalibreWebCompanion/library/models.py b/CalibreWebCompanion/library/models.py index 81e0aa8..0635566 100644 --- a/CalibreWebCompanion/library/models.py +++ b/CalibreWebCompanion/library/models.py @@ -7,6 +7,7 @@ # Feel free to rename the models, but don't rename db_table values or field names. from django.db import models from django.urls import reverse +from django.utils.functional import cached_property class Author(models.Model): @@ -224,9 +225,9 @@ class Book(models.Model): through='BookRatingLink', through_fields=('book', 'rating')) - @property + @cached_property def rating(self): - return self.rating.first() + return self.ratings.first() def get_absolute_url(self): """Returns the url to access a particular instance of MyModelName.""" diff --git a/CalibreWebCompanion/library/templates/base.html b/CalibreWebCompanion/library/templates/base.html index 9a31027..f56ba71 100644 --- a/CalibreWebCompanion/library/templates/base.html +++ b/CalibreWebCompanion/library/templates/base.html @@ -79,7 +79,7 @@ @@ -110,10 +110,11 @@
-

You don't have permission to view this.

+

You don't have permission to view this.

- Login + Login
diff --git a/CalibreWebCompanion/library/templates/library/author_detail.html b/CalibreWebCompanion/library/templates/library/author_detail.html index 816bebb..02d8d71 100644 --- a/CalibreWebCompanion/library/templates/library/author_detail.html +++ b/CalibreWebCompanion/library/templates/library/author_detail.html @@ -17,7 +17,8 @@ {{ book.title }} {{book.author_sort}} - {% for rating in book.ratings.all %} + + {% for rating in book.ratings.all %} {{rating}} {% endfor %} diff --git a/CalibreWebCompanion/library/templates/library/rating_detail.html b/CalibreWebCompanion/library/templates/library/rating_detail.html index 69ed2c6..bf8fa94 100644 --- a/CalibreWebCompanion/library/templates/library/rating_detail.html +++ b/CalibreWebCompanion/library/templates/library/rating_detail.html @@ -17,9 +17,8 @@ {{ book.title }} {{book.author_sort}} - {% for rating in book.rating.all %} + {{rating}} - {% endfor %} {% for tag in book.tags.all %} diff --git a/CalibreWebCompanion/library/templates/library/tag_detail.html b/CalibreWebCompanion/library/templates/library/tag_detail.html index b3401cd..7ca92cb 100644 --- a/CalibreWebCompanion/library/templates/library/tag_detail.html +++ b/CalibreWebCompanion/library/templates/library/tag_detail.html @@ -22,7 +22,7 @@ {% endfor %} - {% for tag in book.tag.all %} + {% for tag in book.tags.all %} {{tag}}, {% endfor %}