コード例 #1
0
def get_price(price_name):
    "Looks up the current price for the given cost code."
    price = Price.query(Price.name == price_name).get()

    if not price:
        raise ValueError("Price %s not found." % price_name)

    return price.price
コード例 #2
0
ファイル: api.py プロジェクト: LegitInc/legitapi
def get_price(price_name):
    "Looks up the current price for the given cost code."
    price = Price.query(Price.name == price_name).get()
    
    if not price:
        raise ValueError("Price %s not found." % price_name)
    
    return price.price
コード例 #3
0
ファイル: main.py プロジェクト: reedroberts-qb/arithmancer
def GetPrices(prediction_id):
    prices = Price.query(Price.prediction_id == ndb.Key(
        urlsafe=prediction_id)).order(-Price.date).fetch(30)
    print(str(prices))
    prices = [{
        'price': p.value,
        'date': {
            'year': p.date.year,
            'month': p.date.month,
            'day': p.date.day
        }
    } for p in prices]
    return prices
コード例 #4
0
def prices_management():
    if request.method == "POST":
        form = CreatePriceForm(request.form)
        if form.validate():
            price = Price(name=form.name.data, price=form.price.data)
            price.put()
    else:
        form = CreatePriceForm()

    existing_prices = Price.query().fetch(100)

    return render_template("admin/prices.html",
                           existing_prices=existing_prices,
                           form=form)
コード例 #5
0
ファイル: admin.py プロジェクト: LegitInc/legitapi
def prices_management():
    if request.method == "POST":
        form = CreatePriceForm(request.form)
        if form.validate():
            price = Price(name=form.name.data, price=form.price.data)
            price.put()
    else:
        form = CreatePriceForm()
        
    existing_prices = Price.query().fetch(100)
    
    return render_template("admin/prices.html",
                            existing_prices=existing_prices,
                            form=form)