Exemple #1
0
 def get(self):
     file = open('header.html')
     self.response.write(file.read())
     query = int(self.request.get("query"))
     BK = Book.query(Book.BPages <= query)
     self.response.write(
         "<table align = 'center' border='1' cellspacing='10' cellpadding = '10'>"
     )
     self.response.write("<tr>")
     self.response.write("<td><b>Book Code</b></td>")
     self.response.write("<td><b>Book Title</b></td>")
     self.response.write("<td><b>Book Price</b></td>")
     self.response.write("<td><b>Book Pages</b></td>")
     self.response.write("<td><b>Book Pub</b></td>")
     self.response.write("<td><b>Book Desc</b></td>")
     self.response.write("</tr>")
     for b in BK:
         self.response.write("<tr>")
         self.response.write("<td>" + str(b.BCode) + "</td>")
         self.response.write("<td>" + b.BTitle + "</td>")
         self.response.write("<td>" + str(b.BPrice) + "</td>")
         self.response.write("<td>" + str(b.BPages) + "</td>")
         self.response.write("<td>" + b.BPub + "</td>")
         self.response.write("<td>" + b.BDesc + "</td>")
         self.response.write("</tr>")
     self.response.write("</table")
Exemple #2
0
    def get(self):
        books = (Book.query().filter(Book.listed == True).filter(
            Book.status == 'approved').filter(Book.deleted == False).order(
                -Book.display_order, -Book.votes_for).fetch(10))
        for book in books:
            if book.book_image:
                book.book_image = json.loads(book.book_image)['link']
            if book.icon:
                book.icon = json.loads(book.icon)['link']
            book.author_users = [
                user.to_client_dict() for user in User.get_by_id(book.authors)
            ]
        pages = (Page.query().filter(Page.listed == True).filter(
            Page.status == 'approved').filter(Book.deleted == False).order(
                -Page.display_order, -Page.votes_for).fetch(5))
        for page in pages:
            if page.iconPath:
                page.icon_thumbnail = page.iconPath + '?size=120'
            page.author_users = [
                user.to_client_dict() for user in User.get_by_id(page.authors)
            ]

        self.write(
            'main.html',
            featuredBooks=books,
            featuredPages=pages,
        )
Exemple #3
0
 def get(self):
     file = open('header.html')
     self.response.write(file.read())
     book_all = Book.query()
     values = {"book_info": book_all}
     template = JINJA_ENVIRONMENT.get_template('viewbook.html')
     html = template.render(values)
     self.response.write(html)