From 5a83ccfc07e52f196161ea611a15900c33c70fce Mon Sep 17 00:00:00 2001 From: MassiveAtoms Date: Tue, 14 Jul 2020 19:48:54 -0300 Subject: [PATCH] fixed some templating issues --- CalibreWebCompanion/db.sqlite3 | Bin 131072 -> 131072 bytes .../library/__pycache__/models.cpython-38.pyc | Bin 10683 -> 10751 bytes .../library/__pycache__/views.cpython-38.pyc | Bin 6072 -> 6072 bytes CalibreWebCompanion/library/models.py | 5 +++-- .../library/templates/base.html | 7 ++++--- .../templates/library/author_detail.html | 3 ++- .../templates/library/rating_detail.html | 3 +-- .../library/templates/library/tag_detail.html | 2 +- 8 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CalibreWebCompanion/db.sqlite3 b/CalibreWebCompanion/db.sqlite3 index 0604770795615e63d9381b54b41c21abc8cc3076..d5c379a4f18ea19dfe752a7977998fc61166cdd1 100644 GIT binary patch delta 94 zcmZo@;Am*zm>|vQG*QNx(P?ACl6Ynop03U839j5M3=E8Rn**}9u<)?(=Q8kb=fA_B v%RgzeK!F86P>w;h*{6QHPd(#~0%jKe*6r*c7~{d>@{IU_}cAf;$BTvruca1PlcaNB|GF z58MxJ4@k2Ra5xVHBm+$WgG_(7On(8ma03MoX153M0bdUU9s@xElW=SrmxTWTeBI0% A_W%F@ diff --git a/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc b/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc index 1d3aac9715c3b9921fbdc29d957a2624f9f16e7d..9625490e6f5e2d2cf2caf6080d9ab10a86b16f2a 100644 GIT binary patch literal 10751 zcmcIq&2Qtz6&EE+qCPC!vc1lJYqKAXlg0^x1TE4u(SBr;ZFb#s?KCZ6K%h0WEw4V@ zA+?Q-_E2olLxIhq#{va5haPN2W4JUra*Z?oCf8z zrc8r!Mw|uZtfo{!IVaA8a$ZwrK)E0;f^tz)W)@MdxHp%lLHi_}*7k+H$6Vy?_r@7;I(zU+E6f77k? zWxMA0YEHB1dS1<`Z9CF$HT!Kx)>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S4ks`X5|g1&yUu$v85428SVr(0RI&$v}?-D~gpO z3K}|>AHrK!@Y3dG3|`veOXqwFctuE#mk$cyIf-MK*W(bMOX`Y&OtRX^gC>BvjPg?H zUIsl&)1R5)0n1ck;7fv9#2c|QO4_lDI0o+4`yAWT>DZIfbHtwxeMYdSgD~n%$Kbg* zHBAyjT@+9tjr>Jn#*Mzh}b+VCr4wm z+6)u1`G{k$S4b5U8;|Kl9e$jAwe;{?@_U>fF1I#Y@1 zTPz1a8u^Pjp2DpJ9>e8_!edtYjjFbWsd8bA9`hxV(M}jKfgim=icTyWC-D{%$e*s1)H8nH<;fqPWyNpRWT}6J z_|PvA#DTUf`b9hzK|)xSkmo855hbiBbjZuOh>F5h1-8Q|s?*g<^-OiCI#Zp)=Pf+VfL5$l{tvoV(YgQt diff --git a/CalibreWebCompanion/library/__pycache__/views.cpython-38.pyc b/CalibreWebCompanion/library/__pycache__/views.cpython-38.pyc index 5089de3c09fceb9dbe9b81199cccf93149f6aa18..f897e15b81500fb3374fcd3a74fa184b85858a4c 100644 GIT binary patch delta 19 Zcmdm?zeArZl$V!_0SL5AH*&2L2LLU41Tg>r delta 19 Zcmdm?zeArZl$V!_0SMHzHgc^K2LLTA1R?+c 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 %}