+
+
+@route('/books-by-author/<id:int>/', method='GET')
+@cheetah_view('books_by_author.tmpl')
+def books_by_author(id):
+ return {
+ 'author': Author.get(id),
+ 'books': Book.select(
+ Book.j.authors & (Author.q.id == id),
+ orderBy=['series', 'ser_no', 'title'],
+ )
+ }
+
+
+@route('/static/<filename:path>')
+def send_static(filename):
+ return static_file(
+ filename, root=os.path.join(
+ os.path.dirname(__file__),
+ 'static'
+ )
+ )
+
+
+@route('/download/<id:int>/', method='GET')
+@cheetah_view('download.tmpl')
+def download_book(id):
+ book = Book.get(id)
+ download(book, get_config().get('download', 'path'))
+ return {
+ 'message': u'Книга сохранена',
+ }