Beispiel #1
0
def index():
    products = []
    for p in Product.select():
        products.append({
            "recid":
            p.id,
            "title":
            p.title,
            "price_dns":
            get_float(p.get_last_price_dns()),
            "price_techopoint":
            get_float(p.get_last_price_technopoint()),
            "link_dns":
            p.url,
            "link_techopoint":
            p.get_technopoint_url(),
        })

    prices = dict()
    for p in Price.select():
        if p.product_id not in prices:
            prices[p.product_id] = []

        prices[p.product_id].append({
            "recid":
            p.id,
            "datetime":
            p.date.isoformat(),
            "price_dns":
            get_float(p.value_dns),
            "price_techopoint":
            get_float(p.value_technopoint),
        })

    return render_template('index.html', products=products, prices=prices)
Beispiel #2
0
def index():
    products = [(p.id, p.title, p.get_last_price_dns(),
                 p.get_last_price_technopoint(), p.url,
                 p.get_technopoint_url()) for p in Product.select()]
    prices = [(p.id, p.date, p.value_dns, p.value_technopoint, p.product_id)
              for p in Price.select()]
    return render_template('index.html', products=products, prices=prices)
Beispiel #3
0
def index():
    titles = [p['title'] for p in get_tracked_products() if p.get('visible')]

    products = [(p.id, p.title, p.get_last_price_dns(),
                 p.get_last_price_technopoint(), p.url,
                 p.get_technopoint_url()) for p in Product.select()]
    prices = [(p.id, p.date, p.value_dns, p.value_technopoint, p.product_id)
              for p in Price.select()]
    return render_template('index_old.html', products=products, prices=prices)
Beispiel #4
0
 def get(self):
     return [_to_json(p) for p in Product.select()]