from . import models from rakka.utils import rerender @rerender def index(): books=models.Book.objects.all() #Make table I guess, for now just get data up there contents='
\n'.join([f'{book} - {book.last_updated}' for book in books]) return {'title':'Booklist','content':contents+"
\nYou should be able to read books now.",'date':'2021/10/24'} @rerender def book(bookurl): book=models.Book.objects.filter(url=bookurl)[0] chapters=models.Chapter.objects.filter(book=book).order_by('added') return {'title':book.title,'content':'Top
\n'+'
\n'.join([f'{chap} - {chap.added}' for chap in chapters]),'date':book.last_updated} @rerender def chapter(bookurl,chapnum): book=models.Book.objects.filter(url=bookurl)[0] chapter=models.Chapter.objects.filter(book=book,number=chapnum)[0] text='

'+chapter.contents.replace('<','<').replace('>','>').replace('\n\n','

').replace('\n','
')+'

' return {'title':chapter,'content':'

Navigation buttons will come later...

\n'+text,'date':chapter.added}