From 14f14a2f338eb81f838025edbd714625e288acf2 Mon Sep 17 00:00:00 2001 From: MassiveAtoms Date: Wed, 15 Jul 2020 12:20:35 -0300 Subject: [PATCH] ??? --- .../library/__pycache__/models.cpython-38.pyc | Bin 10781 -> 10796 bytes .../library/__pycache__/urls.cpython-38.pyc | Bin 1099 -> 1227 bytes .../library/__pycache__/views.cpython-38.pyc | Bin 6252 -> 7015 bytes CalibreWebCompanion/library/models.py | 6 +-- .../library/templates/base.html | 24 +++++++++-- .../library/templates/library/book_list.html | 4 +- .../templates/library/series_detail.html | 38 ++++++++++++++++++ .../templates/library/series_list.html | 17 ++++++++ CalibreWebCompanion/library/urls.py | 3 ++ CalibreWebCompanion/library/views.py | 17 +++++++- 10 files changed, 101 insertions(+), 8 deletions(-) create mode 100644 CalibreWebCompanion/library/templates/library/series_detail.html create mode 100644 CalibreWebCompanion/library/templates/library/series_list.html diff --git a/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc b/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc index 8b6e950dbb32511b865e82450444533b61afd862..4daacd3707a811db84cde2a93468e14108b44ebd 100644 GIT binary patch delta 355 zcmYL_yG{Z@6ozLnvh2#Ruv~Uoc3D8Y;N>lhK7ecCG-~os0nuh-PXR3zor#IG#>Vgh z);@wy;Ujo*3Ybae&v(B6H1n2!=JHlbPtXZm|NiGoK7^SAgRZ$WRaslp9l6?i_ts+d z8un*Xdt0i~*j@|eQ`RW!w6wDUQDfU}QpcfAi>7TI!h(&xrKKX~4oYyCW8Fm=?n2BB zm9R_UVV_-(+^ho0GGp0C6+X)W$r|eHhU^Xypuuj$e26Am%t!hdZG_xCL4?jis4-%6 zDNnBj5~K@(bZ)9M^lrpBD@OEBc~KH#^AQbg<9zj9iK9Cj76W>I<>ljx&L_|MYNDU8 I`AaV3KN~DnZU6uP delta 324 zcmYk2yG{Z@6ozLn2)i)5To(4it}H6xB{aT-FMx&9pvgZCrIj58TS7%=VuHPm+1~hO zdN>6zlg!EYe}7IfU$c*ye3a4^bmBK}{_`!L!>J8}uDLN)Ra=WA)wH#9K812m)9pIU zmphwckF-y-d8$>5sC`)2q0YV=P}g+Od z4M=w9>|O@&;Iqt0Hql}^WO;!$I_xf)uMnWiJkn$I5OQ~d2yr3QH4^k`-aH7T$O?gM cWvbiqJ-WAzyX|iyah~Y2UWfFQf9X{I1GuG4EdT%j diff --git a/CalibreWebCompanion/library/__pycache__/urls.cpython-38.pyc b/CalibreWebCompanion/library/__pycache__/urls.cpython-38.pyc index e3f0bc47493e391d8e9bb0acb59ea92ca015fa04..9f8441360f9f4bb496f5e1fb54633ae0b6c017c6 100644 GIT binary patch delta 237 zcmX@jahg**l$V!_0SL^6_~Uo8Ffcp@agc#9kmCTv#aa`!f14~|UC59km%`S|oXVIY zpURvi1Qt<%iYNj_gj1A2ymbC3krd@%22GX8W{max?8T`?nW@G4x7fgp$(tExNbp0& zY%=potO~O2s)Qf{lkJ#t8AT_rVJc+j3kGYOEW#YbE&ydmGkdcM0bNuiG$ X$-~IQD#Qqf%y1T?5EGEi#P=2e@-sC2 delta 140 zcmX@jd748zl$V!_0SMOA@x{xqFfcp@agc!^kmCTv#cUI`e+#6@rLgrfr}IV$rN{>} zXevyOVyvJ1igDWHrA!Ho!jsvU3n#ZTdrp4D?7#-nSR^=EgQZqU4#?zTNpl;=6`ma+2#^p+iJ}&2U!Vn4ti*8~MWz;SiA>9)Bqvi$p@!%oIN%Hb_Y5fs z1zkc_TuzmeL#lFd7RjgRKO}#ouQ~agn-6im*E3iMP}IUyN?>(Q_t)F&eqX3KdhGkjqk+PxMhu9b! zf27!lKU7$r?RuoJU9Mg`vZ32YffU#TkO?5ifE))h$#w(ToggQG>|s+trV`{NkiBdg z$aI3704gxutAVnZE>=2Mc333L=VRi(_5g=zV`Z*v+*)br;668FP zBq{D7TXP>ScjCA~gVg~i=Eb9qq} zsj6FdxmWoXx>bry{IF^{N;nIIeQTtFMZYn`=wH z7p}Nm=(nA!7^QL~WTC7aHt-3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g~H9i2t% zRfIW&V`Sc8M)0*-nI3dLEDe33Oq_fhnkDl($ed;urMpLD{ul0l37HRY))|%vjXWmA=AOd7VbtW<0&yj05ofrD^o^E~)ya zRw%1@5%O2jbRFD_6rUuDj|m+`z)P6o6-w~}G~H8bxlq*jK)fF+r=On+zGs$^v(6On mCGcdyO$ZO-mZpvg@MW9<@CsgGkX=ZmJYrA``hr1dzW)JegUU4k diff --git a/CalibreWebCompanion/library/models.py b/CalibreWebCompanion/library/models.py index 0943333..d4a0545 100644 --- a/CalibreWebCompanion/library/models.py +++ b/CalibreWebCompanion/library/models.py @@ -174,9 +174,9 @@ class Book(models.Model): title = models.TextField() sort = models.TextField(blank=True, null=True) # This field type is a guess. - timestamp = models.TextField(blank=True, null=True) + timestamp = models.DateTimeField(blank=True, null=True) # This field type is a guess. - pubdate = models.TextField(blank=True, null=True) + pubdate = models.DateTimeField(blank=True, null=True) series_index = models.FloatField() author_sort = models.TextField(blank=True, null=True) isbn = models.TextField(blank=True, null=True) @@ -185,7 +185,7 @@ class Book(models.Model): flags = models.IntegerField() uuid = models.TextField(blank=True, null=True) has_cover = models.BooleanField(blank=True, null=True) - last_modified = models.TextField() # This field type is a guess. + last_modified = models.DateTimeField() # This field type is a guess. authors = models.ManyToManyField( Author, through='BookAuthorLink', diff --git a/CalibreWebCompanion/library/templates/base.html b/CalibreWebCompanion/library/templates/base.html index 02f5c14..1dbb70d 100644 --- a/CalibreWebCompanion/library/templates/base.html +++ b/CalibreWebCompanion/library/templates/base.html @@ -59,12 +59,19 @@ + + + {% else %}
  • Sign up
  • Login
  • diff --git a/CalibreWebCompanion/library/templates/library/book_list.html b/CalibreWebCompanion/library/templates/library/book_list.html index c05a32d..0750391 100644 --- a/CalibreWebCompanion/library/templates/library/book_list.html +++ b/CalibreWebCompanion/library/templates/library/book_list.html @@ -16,6 +16,7 @@ Rating Tags Added + Published {% for book in book_list %} @@ -30,7 +31,8 @@ {{tag}}, {% endfor %} - {{book.timestamp}} + {{book.timestamp | timesince}} ago + {{book.pubdate.year}} {% endfor %} diff --git a/CalibreWebCompanion/library/templates/library/series_detail.html b/CalibreWebCompanion/library/templates/library/series_detail.html new file mode 100644 index 0000000..f824015 --- /dev/null +++ b/CalibreWebCompanion/library/templates/library/series_detail.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} + +{% block content %} + +

    {{Series}}

    + + + + + + + + + + + + {% for book in books %} + + + + + + + + {% endfor %} +
    TitleAuthorRatingTagsAdded
    {{ book.title }}{{book.author_sort}} {% for rating in book.rating.all %} + {{rating}} + {% endfor %} + + {% for tag in book.tags.all %} + {{tag}}, + {% endfor %} + {{book.timestamp}}
    + + + + +{% endblock %} \ No newline at end of file diff --git a/CalibreWebCompanion/library/templates/library/series_list.html b/CalibreWebCompanion/library/templates/library/series_list.html new file mode 100644 index 0000000..c2060e0 --- /dev/null +++ b/CalibreWebCompanion/library/templates/library/series_list.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} + +{% block content %} + +

    Author List

    + {% if series_list %} + + {% else %} +

    There are no series in the library.

    + {% endif %} +{% endblock %} \ No newline at end of file diff --git a/CalibreWebCompanion/library/urls.py b/CalibreWebCompanion/library/urls.py index 6a5e2a1..5271440 100644 --- a/CalibreWebCompanion/library/urls.py +++ b/CalibreWebCompanion/library/urls.py @@ -9,11 +9,14 @@ urlpatterns = [ path('publishers/', views.PublisherListView.as_view(), name='publishers'), path('ratings/', views.RatingListView.as_view(), name='ratings'), path('tags/', views.TagListView.as_view(), name='tags'), + path('series/', views.SeriesListView.as_view(), name='series'), + path('author/', views.AuthorDetailView.as_view(), name='author-detail-view'), path('book/', views.BookDetailView.as_view(), name='book-detail-view'), path('publisher/', views.PublisherDetailView.as_view(), name='publisher-detail-view'), path('rating/', views.RatingDetailView.as_view(), name='rating-detail-view'), + path('series/', views.SeriesDetailView.as_view(), name='series-detail-view'), path('tag/', views.TagDetailView.as_view(), name='tag-detail-view'), path('results/', views.ResultsView.as_view(), name='results'), diff --git a/CalibreWebCompanion/library/views.py b/CalibreWebCompanion/library/views.py index 271e4be..146e306 100644 --- a/CalibreWebCompanion/library/views.py +++ b/CalibreWebCompanion/library/views.py @@ -1,6 +1,6 @@ from django.shortcuts import render from django.views import generic -from .models import Author, Book, Comment, Rating, BookAuthorLink, Publisher, Tag, BookTagLink, BookRatingLink, Data, Identifier +from .models import Author, Book, Comment, Rating, BookAuthorLink, Publisher, Tag, BookTagLink, BookRatingLink, Data, Identifier, Series from django.http import HttpResponseRedirect from .forms import SearchForm, UserCreationForm from django.db import models @@ -79,6 +79,9 @@ class PublisherListView(generic.ListView): class RatingListView(generic.ListView): model = Rating +class SeriesListView(generic.ListView): # make url entry and template, sometime + model = Series + class TagListView(generic.ListView): model = Tag @@ -152,3 +155,15 @@ class TagDetailView(generic.DetailView): books = books.filter(tags=context["object"].id) context['books'] = sorted(books, key=lambda x: x.title) return context + +class SeriesDetailView(generic.DetailView): + model = Series + + def get_context_data(self, **kwargs): + # Call the base implementation first to get the context + context = super(SeriesDetailView, self).get_context_data(**kwargs) + # Create any data and add it to the context + books = Book.objects.prefetch_related("tags", "ratings") + books = books.filter(series=context["object"].id) + context['books'] = sorted(books, key=lambda x: x.title) + return context \ No newline at end of file