mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 13:17:50 +02:00
Add a book details page in bookshelf
This commit is contained in:
@@ -344,10 +344,33 @@ class Types(GetData):
|
||||
class Books(GetData):
|
||||
def __init__(self):
|
||||
self.title = "Books"
|
||||
self.template = "books.html"
|
||||
self.template = "bookshelf/books.html"
|
||||
self.data = Book.objects.all()
|
||||
|
||||
|
||||
class GetBook(View):
|
||||
def get(self, request, uuid):
|
||||
try:
|
||||
book = Book.objects.get(uuid=uuid)
|
||||
except ObjectDoesNotExist:
|
||||
raise Http404
|
||||
|
||||
book_properties = (
|
||||
book.property.all()
|
||||
if request.user.is_authenticated
|
||||
else book.property.filter(property__private=False)
|
||||
)
|
||||
return render(
|
||||
request,
|
||||
"bookshelf/book.html",
|
||||
{
|
||||
"title": book,
|
||||
"book_properties": book_properties,
|
||||
"book": book,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
class GetFlatpage(View):
|
||||
def get(self, request, flatpage):
|
||||
try:
|
||||
@@ -359,6 +382,6 @@ class GetFlatpage(View):
|
||||
|
||||
return render(
|
||||
request,
|
||||
"flatpage.html",
|
||||
"flatpages/flatpage.html",
|
||||
{"title": flatpage.name, "flatpage": flatpage},
|
||||
)
|
||||
|
Reference in New Issue
Block a user