Example #1
0
def prepare_authors_select():
    """Render Select-Box wirh authors."""
    data = Author.get_all()
    options = [{"id": el.get("id"), "text": "%s %s" % (el.get("name"), el.get("surname"))} for el in data]
    select = {"id": "book_author", "options": options}
    return render_template("select.html", select=select)
Example #2
0
def prepare_authors_table():
    """Render table with authors."""
    row_data = Author.get_all()
    rows = [{"id": el.get("id"), "cells": [el.get("name"), el.get("surname")]} for el in row_data]
    table = {"headers": ["Name", "Surname"], "rows": rows}
    return render_template("table.html", table=table)