summaryrefslogtreecommitdiff
path: root/app/books/views.py
blob: e82947641fd90e33c7b2676aee13cb26c9aa415a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from django.views.generic.detail import DetailView
from utils.views import PaginatedListView

from .models import Book


class BookListView(PaginatedListView):
    template_name = 'archives/books.html'

    def get_queryset(self):
        return Book.objects.filter(is_public=True).order_by('-read_date').select_related()


class BookDetailView(DetailView):
    model = Book
    template_name = "details/book.html"
    slug_field = "slug"